From ae5b97c807ced433e7e72cf0683491c7dd0152d1 Mon Sep 17 00:00:00 2001 From: Jonathan Innis Date: Wed, 30 Mar 2022 01:40:08 -0700 Subject: [PATCH] [k8s-configuration] Release v1.5.0 with updated api-version to 2022-03-01 for GA (#4587) * Create pull.yml * Update pull.yml * Update azure-pipelines.yml * Initial commit of k8s-extension * Update CODEOWNERS * Update azure-pipelines.yml * Create pull.yml * Update pull.yml * Update pull.yml * Update pipelines file * Update k8s-configuration name * Update test script params * Update pipeline file * Remove codeowners * Update pipelines file * Update CODEOWNERS * Update private preview pipelines * Remove open service mesh from public release * Update pipeline files * Update custom pipelines files * Add publish step to k8s-configuration * Update pipeline to publish extension * Update public extension pipeline * Change condition variable * Update pipeline naming * Add version to public preview/private preview * Update pipelines * Add different testing based on private branch * Add annotations to extension model * Update k8s-custom-pipelines.yml * Update SDKs with Updated Swagger Spec for 2020-07-01-preview (#13) * Update sdks with updated swagger spec * Update version and history rst * Reorder release history timeline * Fix ExtensionInstanceForCreate for import * remove py2 bdist support * Add custom table formatting * Remove unnecessary files * Fix style issues * Fix branch based on comments * Update identity piece manually * Don't handle defaults at the CLI level * Remove defaults from CLI client * Check null target namespace with namespace scope * Update style * Add cassandra operator and location to model * Stage Public Version of k8s-extension 0.2.0 for official release (#15) * Create pull.yml * Update pull.yml * Update azure-pipelines.yml * Initial commit of k8s-extension * Update pipelines file * Update CODEOWNERS * Update private preview pipelines * Remove open service mesh from public release * Update pipeline files * Update public extension pipeline * Change condition variable * Add version to public preview/private preview * Update pipelines * Add different testing based on private branch * Add annotations to extension model * Update k8s-custom-pipelines.yml * Update SDKs with Updated Swagger Spec for 2020-07-01-preview (#13) * Update sdks with updated swagger spec * Update version and history rst * Reorder release history timeline * Fix ExtensionInstanceForCreate for import * remove py2 bdist support * Add custom table formatting * Remove unnecessary files * Fix style issues * Fix branch based on comments * Update identity piece manually * Don't handle defaults at the CLI level * Remove defaults from CLI client * Check null target namespace with namespace scope * Update style * Add cassandra operator and location to model Co-authored-by: action@github.com * Remove custom pipelines file * Update extension description, remove private const * Update pipeline file * Disable check ref docs * Disable refs docs * Update to include better create warning logs and remove update context (#20) * Update to include better create warning logs and remove update context * Remove help text for update * Fix spelling error * Update message * Fix k8s-extension conflict with private version * Fix style errors * Fix filename * add customization for microsoft.azureml.kubernetes (#23) * add customization for microsoft.azureml.kubernetes * Update release history Co-authored-by: Yue Yu Co-authored-by: jonathan-innis * Add E2E Testing from Separate branch into internal code (#26) * Add internal e2e testing * Change to testing folder * Inference CLI validation for Scoring FE (#24) * cli validation starter * added the call to the fe validation function * nodeport validation not required * test fix Co-authored-by: Jonathan Innis * legal warning added (#27) * Remove deprecated method logger.warn * Update k8s-custom-pipelines.yml for Azure Pipelines * Update k8s-custom-pipelines.yml for Azure Pipelines * Add Azure Defender to E2E testing (#28) * Add azure defender testing to e2e * Remove the debug flag * Add configuration testing * Fix pipeline failures * Make test script more intuitive * Remove parameter from testing * Add some debug * Fix wrong location for k8s config whl * Fix pip install upgrade issue * Fix pip install upgrade issue * Add Check for Provider Registration and Refactor (#19) * Add check for provider registration and refactor * Fix bug in checking registration * Add license header to utils * Update private key check and error messaging * Update based on refactoring * Fix failing tests * Add provider registration check * Create a test for uppercase url, address comments * Add blank line to fix style check * Testing increase to ubuntu-latest * Update k8s-configuration Models to Track2 (#63) * Update models to track2 * Increase k8s-configuration version number * Update kind version * Change error to warning because of DSA failure * Upgrade helm operator chart version (#75) * Pin helm version * Bump version * Migrate pipeline (#90) * Disable updates on configuration tests (#89) * Release k8s-configuration v1.2.0 for Flux v2 Public Preview (#86) * Scaffold out the k8s-config package * Base implementation of CLI commands * Add create scenario and cleanup in consts * Add help text to commands, params * Add other clients to client factory * Automatically installing the flux extension * Move flux and extension into modules * Updated the versioned sdks * Push working command for testing * Update to multi api versioned sdk * Support other extension methods * Fix nullity check * Add source control provider * Add scc commands * Add defer logic for create with cache * Use default extension with identity * Fix identity creation * Add kustomization caching * Add formatters * Add scc provider * Add help text for k8s-config fluxv1 * Add help text for extension * Allow force delete of extension and fluxconfiguration * Add location to the extension model * Update with latest from k8s-extension * Add k8s-config testing * Add license header * Fix all style issues * Update codeowners file * Validate data before checking cluster compliance * No kustomizations warning * Fix identity issue in 2020-07-01 * Fix k8s regex * Fix configuration name regex validation * Fix name length validation * Adding some validation warnings * Add protected settings to request * Exclude private test path * Add suspend functionality * Add correct values to build Kustomization * Add no_wait * Fix style issues * Use base64 encoded httpsUser * Fix formatting error and base64 encoding error * Fix style issues * Fix force * Updated help text * Style fixes * Increase namespace maximum len * Add managed cluster support to k8s-config * Custom confirmation when prune is enabled * Add flux commands to existing k8s-configuration * Remove extension provider from CLI * Fix style issues * Override extension variables * Strip newlines from known_hosts file * Update help text and validators * Strip newlines from known hosts * Add provisioning state check for flux extension * Pin helm version * Remove validation from create command * Add patch support with new SDK * Add implementation for CRUD of source and kustomization * Fix errors on patch * Fix some bugs in patching properties * Add fixes for patch in k8s-configuraiton * Change duration formatting in table output * Add validation and conversion for durations * Bump verison and fix typo * Fix bug with dependencies * Fix linter and style issues * Fix delete prune check * Add flux testing * Create separate jobs for scenarios * Update error text * Fix filepath suggestion from CLI team * Fix unneeded file edit * Add a Deployed Object List to the Flux CLI (#91) * Enable a deployed object list on the CLI * Show detail when extension install fails * Bump version * Update deployed object format (#93) * Fix help text for consistency * Enable Bucket Support in the CLI (#92) * Update vendored_sdks * Enable source kind generation factories and use kwargs to pass to provider * Add better validation logic to source generator * Move away from classes in the provider directory * Fix style issues using black auto-formatter * Fix linter failures * Update identity with api version and rp in same function * Bucket Testing for E2E Testing (#96) * Bucket testing * Add switching kind test to update CLI * Bump version * Fix help text and parameter naming for bucket (#100) * Fix default help text for parameters (#101) * Edit history with breaking change * Prepare GA FluxConfiguration 2022-03-01 (#103) * Add vendored sdks for new api-version * Update the new depends on definition * Update table formatting * BucketDefinition to BucketPatchDefinition * Remove http url warning * Update vendored_sdks * Update action file to add depenencies * Remove preview from command groups * Update changelog * Make dependencies none when not specified * Remove unneeded files Co-authored-by: action@github.com Co-authored-by: yuyue9284 <15863499+yuyue9284@users.noreply.github.com> Co-authored-by: Yue Yu Co-authored-by: Lia Kazakova <58274127+liakaz@users.noreply.github.com> --- src/k8s-configuration/HISTORY.rst | 5 + .../azext_k8s_configuration/action.py | 18 +- .../azext_k8s_configuration/commands.py | 3 - .../azext_k8s_configuration/consts.py | 8 +- .../azext_k8s_configuration/format.py | 10 +- .../providers/FluxConfigurationProvider.py | 26 +- .../SourceControlConfigurationProvider.py | 2 +- .../test_k8s_configuration_success.yaml | 509 +++- .../test_kubernetesconfiguration_scenario.py | 8 +- .../azext_k8s_configuration/utils.py | 2 + .../azext_k8s_configuration/validators.py | 2 - .../vendored_sdks/_configuration.py | 4 +- .../_source_control_configuration_client.py | 34 +- .../vendored_sdks/_version.py | 2 +- .../vendored_sdks/aio/_configuration.py | 4 +- .../_source_control_configuration_client.py | 35 +- .../vendored_sdks/models.py | 4 +- .../v2020_07_01_preview/__init__.py | 9 +- .../v2020_07_01_preview/_configuration.py | 19 +- .../v2020_07_01_preview/_patch.py | 31 + .../_source_control_configuration_client.py | 98 +- .../v2020_07_01_preview/_vendor.py | 27 + .../v2020_07_01_preview/aio/__init__.py | 5 + .../v2020_07_01_preview/aio/_configuration.py | 6 +- .../v2020_07_01_preview/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 86 +- .../aio/operations/_extensions_operations.py | 262 +- .../aio/operations/_operations.py | 50 +- ...ource_control_configurations_operations.py | 241 +- .../v2020_07_01_preview/models/__init__.py | 66 +- .../v2020_07_01_preview/models/_models.py | 817 ------ .../v2020_07_01_preview/models/_models_py3.py | 394 ++- ...urce_control_configuration_client_enums.py | 39 +- .../operations/_extensions_operations.py | 572 +++-- .../operations/_operations.py | 91 +- ...ource_control_configurations_operations.py | 499 ++-- .../v2020_10_01_preview/__init__.py | 9 +- .../v2020_10_01_preview/_configuration.py | 19 +- .../v2020_10_01_preview/_patch.py | 31 + .../_source_control_configuration_client.py | 91 +- .../v2020_10_01_preview/_vendor.py | 27 + .../v2020_10_01_preview/aio/__init__.py | 5 + .../v2020_10_01_preview/aio/_configuration.py | 6 +- .../v2020_10_01_preview/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 79 +- .../aio/operations/_operations.py | 50 +- ...ource_control_configurations_operations.py | 241 +- .../v2020_10_01_preview/models/__init__.py | 42 +- .../v2020_10_01_preview/models/_models.py | 506 ---- .../v2020_10_01_preview/models/_models_py3.py | 213 +- ...urce_control_configuration_client_enums.py | 33 +- .../operations/_operations.py | 91 +- ...ource_control_configurations_operations.py | 499 ++-- .../vendored_sdks/v2021_03_01/__init__.py | 9 +- .../v2021_03_01/_configuration.py | 19 +- .../vendored_sdks/v2021_03_01/_patch.py | 31 + .../_source_control_configuration_client.py | 88 +- .../vendored_sdks/v2021_03_01/_vendor.py | 27 + .../vendored_sdks/v2021_03_01/aio/__init__.py | 5 + .../v2021_03_01/aio/_configuration.py | 6 +- .../vendored_sdks/v2021_03_01/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 76 +- .../v2021_03_01/aio/operations/_operations.py | 50 +- ...ource_control_configurations_operations.py | 235 +- .../v2021_03_01/models/__init__.py | 42 +- .../v2021_03_01/models/_models.py | 495 ---- .../v2021_03_01/models/_models_py3.py | 232 +- ...urce_control_configuration_client_enums.py | 35 +- .../v2021_03_01/operations/_operations.py | 91 +- ...ource_control_configurations_operations.py | 493 ++-- .../v2021_05_01_preview/__init__.py | 9 +- .../v2021_05_01_preview/_configuration.py | 19 +- .../v2021_05_01_preview/_patch.py | 31 + .../_source_control_configuration_client.py | 132 +- .../v2021_05_01_preview/_vendor.py | 27 + .../v2021_05_01_preview/aio/__init__.py | 5 + .../v2021_05_01_preview/aio/_configuration.py | 6 +- .../v2021_05_01_preview/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 120 +- .../_cluster_extension_type_operations.py | 47 +- .../_cluster_extension_types_operations.py | 64 +- .../_extension_type_versions_operations.py | 64 +- .../aio/operations/_extensions_operations.py | 268 +- .../_location_extension_types_operations.py | 58 +- .../_operation_status_operations.py | 114 +- .../aio/operations/_operations.py | 50 +- ...ource_control_configurations_operations.py | 241 +- .../v2021_05_01_preview/models/__init__.py | 87 +- .../v2021_05_01_preview/models/_models.py | 1056 -------- .../v2021_05_01_preview/models/_models_py3.py | 477 +++- ...urce_control_configuration_client_enums.py | 43 +- .../_cluster_extension_type_operations.py | 115 +- .../_cluster_extension_types_operations.py | 123 +- .../_extension_type_versions_operations.py | 119 +- .../operations/_extensions_operations.py | 548 ++-- .../_location_extension_types_operations.py | 109 +- .../_operation_status_operations.py | 233 +- .../operations/_operations.py | 91 +- ...ource_control_configurations_operations.py | 499 ++-- .../vendored_sdks/v2021_09_01/__init__.py | 9 +- .../v2021_09_01/_configuration.py | 19 +- .../vendored_sdks/v2021_09_01/_patch.py | 31 + .../_source_control_configuration_client.py | 92 +- .../vendored_sdks/v2021_09_01/_vendor.py | 27 + .../vendored_sdks/v2021_09_01/aio/__init__.py | 5 + .../v2021_09_01/aio/_configuration.py | 6 +- .../vendored_sdks/v2021_09_01/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 80 +- .../aio/operations/_extensions_operations.py | 358 ++- .../_operation_status_operations.py | 114 +- .../v2021_09_01/aio/operations/_operations.py | 50 +- .../v2021_09_01/models/__init__.py | 63 +- .../v2021_09_01/models/_models.py | 739 ------ .../v2021_09_01/models/_models_py3.py | 349 ++- ...urce_control_configuration_client_enums.py | 29 +- .../operations/_extensions_operations.py | 719 ++++-- .../_operation_status_operations.py | 233 +- .../v2021_09_01/operations/_operations.py | 91 +- .../v2021_11_01_preview/__init__.py | 9 +- .../v2021_11_01_preview/_configuration.py | 19 +- .../v2021_11_01_preview/_patch.py | 31 + .../_source_control_configuration_client.py | 148 +- .../v2021_11_01_preview/_vendor.py | 27 + .../v2021_11_01_preview/aio/__init__.py | 5 + .../v2021_11_01_preview/aio/_configuration.py | 6 +- .../v2021_11_01_preview/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 134 +- .../_cluster_extension_type_operations.py | 50 +- .../_cluster_extension_types_operations.py | 70 +- .../_extension_type_versions_operations.py | 64 +- .../aio/operations/_extensions_operations.py | 361 ++- ...flux_config_operation_status_operations.py | 52 +- .../_flux_configurations_operations.py | 371 ++- .../_location_extension_types_operations.py | 58 +- .../_operation_status_operations.py | 114 +- .../aio/operations/_operations.py | 50 +- ...ource_control_configurations_operations.py | 241 +- .../v2021_11_01_preview/models/__init__.py | 126 +- .../v2021_11_01_preview/models/_models.py | 1639 ------------ .../v2021_11_01_preview/models/_models_py3.py | 917 +++++-- ...urce_control_configuration_client_enums.py | 49 +- .../_cluster_extension_type_operations.py | 118 +- .../_cluster_extension_types_operations.py | 133 +- .../_extension_type_versions_operations.py | 119 +- .../operations/_extensions_operations.py | 722 ++++-- ...flux_config_operation_status_operations.py | 124 +- .../_flux_configurations_operations.py | 738 ++++-- .../_location_extension_types_operations.py | 109 +- .../_operation_status_operations.py | 233 +- .../operations/_operations.py | 91 +- ...ource_control_configurations_operations.py | 499 ++-- .../v2022_01_01_preview/__init__.py | 9 +- .../v2022_01_01_preview/_configuration.py | 19 +- .../v2022_01_01_preview/_patch.py | 31 + .../_source_control_configuration_client.py | 148 +- .../v2022_01_01_preview/_vendor.py | 27 + .../v2022_01_01_preview/aio/__init__.py | 5 + .../v2022_01_01_preview/aio/_configuration.py | 6 +- .../v2022_01_01_preview/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 134 +- .../_cluster_extension_type_operations.py | 57 +- .../_cluster_extension_types_operations.py | 77 +- .../_extension_type_versions_operations.py | 64 +- .../aio/operations/_extensions_operations.py | 404 ++- ...flux_config_operation_status_operations.py | 59 +- .../_flux_configurations_operations.py | 410 ++- .../_location_extension_types_operations.py | 58 +- .../_operation_status_operations.py | 128 +- .../aio/operations/_operations.py | 50 +- ...ource_control_configurations_operations.py | 273 +- .../v2022_01_01_preview/models/__init__.py | 146 +- .../v2022_01_01_preview/models/_models.py | 1836 ------------- .../v2022_01_01_preview/models/_models_py3.py | 1132 +++++--- ...urce_control_configuration_client_enums.py | 57 +- .../_cluster_extension_type_operations.py | 121 +- .../_cluster_extension_types_operations.py | 136 +- .../_extension_type_versions_operations.py | 119 +- .../operations/_extensions_operations.py | 733 ++++-- ...flux_config_operation_status_operations.py | 127 +- .../_flux_configurations_operations.py | 745 ++++-- .../_location_extension_types_operations.py | 109 +- .../_operation_status_operations.py | 239 +- .../operations/_operations.py | 91 +- ...ource_control_configurations_operations.py | 511 ++-- .../vendored_sdks/v2022_03_01/__init__.py | 18 + .../v2022_03_01/_configuration.py | 68 + .../vendored_sdks/v2022_03_01/_patch.py | 31 + .../_source_control_configuration_client.py | 113 + .../vendored_sdks/v2022_03_01/_vendor.py | 27 + .../vendored_sdks/v2022_03_01/_version.py | 9 + .../vendored_sdks/v2022_03_01/aio/__init__.py | 15 + .../v2022_03_01/aio/_configuration.py | 67 + .../vendored_sdks/v2022_03_01/aio/_patch.py | 31 + .../_source_control_configuration_client.py | 110 + .../v2022_03_01/aio/operations/__init__.py | 23 + .../aio/operations/_extensions_operations.py | 604 +++++ ...flux_config_operation_status_operations.py | 115 + .../_flux_configurations_operations.py | 607 +++++ .../_operation_status_operations.py | 204 ++ .../v2022_03_01/aio/operations/_operations.py | 111 + ...ource_control_configurations_operations.py | 399 +++ .../v2022_03_01/models/__init__.py | 117 + .../v2022_03_01/models/_models_py3.py | 2268 +++++++++++++++++ ...urce_control_configuration_client_enums.py | 121 + .../v2022_03_01/operations/__init__.py | 23 + .../operations/_extensions_operations.py | 829 ++++++ ...flux_config_operation_status_operations.py | 160 ++ .../_flux_configurations_operations.py | 834 ++++++ .../_operation_status_operations.py | 287 +++ .../v2022_03_01/operations/_operations.py | 137 + ...ource_control_configurations_operations.py | 572 +++++ src/k8s-configuration/setup.py | 2 +- 212 files changed, 22729 insertions(+), 16511 deletions(-) create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_patch.py delete mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/__init__.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_configuration.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_source_control_configuration_client.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_vendor.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_version.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/__init__.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_configuration.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_patch.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_source_control_configuration_client.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/__init__.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_extensions_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_configurations_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operation_status_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_source_control_configurations_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/__init__.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_models_py3.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_source_control_configuration_client_enums.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/__init__.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_extensions_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_config_operation_status_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_configurations_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operation_status_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operations.py create mode 100644 src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_source_control_configurations_operations.py diff --git a/src/k8s-configuration/HISTORY.rst b/src/k8s-configuration/HISTORY.rst index 4c8d242171b..150f337dd9a 100644 --- a/src/k8s-configuration/HISTORY.rst +++ b/src/k8s-configuration/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +1.5.0 +++++++++++++++++++ +* Update models to 2022-03-01 for GA +* Remove unneeded warning for HTTPS urls + 1.4.1 ++++++++++++++++++ * [BREAKING CHANGE] `--access-key` changed to `--bucket-access-key` diff --git a/src/k8s-configuration/azext_k8s_configuration/action.py b/src/k8s-configuration/azext_k8s_configuration/action.py index 7bc2d460742..cc3347eed0c 100644 --- a/src/k8s-configuration/azext_k8s_configuration/action.py +++ b/src/k8s-configuration/azext_k8s_configuration/action.py @@ -6,10 +6,9 @@ import argparse from azure.cli.core.azclierror import InvalidArgumentValueError -from .vendored_sdks.v2022_01_01_preview.models import ( +from .vendored_sdks.v2022_03_01.models import ( KustomizationDefinition, KustomizationPatchDefinition, - DependsOnDefinition, ) from .validators import validate_kustomization from . import consts @@ -18,18 +17,19 @@ class InternalKustomizationDefinition(KustomizationDefinition): def __init__(self, **kwargs): - self.name = kwargs.get("name", "") super().__init__(**kwargs) + # This call is after the call to super() to override the init method + # making the self.name field null + self.name = kwargs.get("name", "") + def to_KustomizationDefinition(self): k_dict = dict(self.__dict__) - del k_dict["name"] del k_dict["additional_properties"] return KustomizationDefinition(**k_dict) def to_KustomizationPatchDefinition(self): k_dict = dict(self.__dict__) - del k_dict["name"] del k_dict["additional_properties"] return KustomizationPatchDefinition(**k_dict) @@ -37,7 +37,7 @@ def to_KustomizationPatchDefinition(self): class KustomizationAddAction(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): validate_kustomization(values) - model_dependency = [] + dependencies = None sync_interval = None retry_interval = None timeout = None @@ -47,10 +47,6 @@ def __call__(self, parser, namespace, values, option_string=None): key, value = item.split("=", 1) if key in consts.DEPENDENCY_KEYS: dependencies = parse_dependencies(value) - for dep in dependencies: - model_dependency.append( - DependsOnDefinition(kustomization_name=dep) - ) elif key in consts.SYNC_INTERVAL_KEYS: sync_interval = value elif key in consts.RETRY_INTERVAL_KEYS: @@ -67,7 +63,7 @@ def __call__(self, parser, namespace, values, option_string=None): parser, namespace, InternalKustomizationDefinition( - depends_on=model_dependency, + depends_on=dependencies, sync_interval_in_seconds=parse_duration(sync_interval), retry_interval_in_seconds=parse_duration(retry_interval), timeout_in_seconds=parse_duration(timeout), diff --git a/src/k8s-configuration/azext_k8s_configuration/commands.py b/src/k8s-configuration/azext_k8s_configuration/commands.py index e42cc830b7b..70451092c37 100644 --- a/src/k8s-configuration/azext_k8s_configuration/commands.py +++ b/src/k8s-configuration/azext_k8s_configuration/commands.py @@ -36,7 +36,6 @@ def load_command_table(self, _): "k8s-configuration flux", k8s_configuration_fluxconfig_client, custom_command_type=flux_configuration_custom_type, - is_preview=True, ) as g: g.custom_command("create", "create_config", supports_no_wait=True) g.custom_command("update", "update_config", supports_no_wait=True) @@ -52,7 +51,6 @@ def load_command_table(self, _): "k8s-configuration flux kustomization", k8s_configuration_fluxconfig_client, custom_command_type=flux_configuration_custom_type, - is_preview=True, ) as g: g.custom_command("create", "create_kustomization", supports_no_wait=True) g.custom_command("update", "update_kustomization", supports_no_wait=True) @@ -72,7 +70,6 @@ def load_command_table(self, _): "k8s-configuration flux deployed-object", k8s_configuration_fluxconfig_client, custom_command_type=flux_configuration_custom_type, - is_preview=True, ) as g: g.custom_command( "list", diff --git a/src/k8s-configuration/azext_k8s_configuration/consts.py b/src/k8s-configuration/azext_k8s_configuration/consts.py index 192f62d6335..a4210dd61e9 100644 --- a/src/k8s-configuration/azext_k8s_configuration/consts.py +++ b/src/k8s-configuration/azext_k8s_configuration/consts.py @@ -7,9 +7,9 @@ # API VERSIONS ----------------------------------------- -SOURCE_CONTROL_API_VERSION = "2021-03-01" -FLUXCONFIG_API_VERSION = "2022-01-01-preview" -EXTENSION_API_VERSION = "2021-09-01" +SOURCE_CONTROL_API_VERSION = "2022-03-01" +FLUXCONFIG_API_VERSION = "2022-03-01" +EXTENSION_API_VERSION = "2022-03-01" # ERROR/HELP TEXT DEFINITIONS ----------------------------------------- @@ -161,8 +161,6 @@ FLUX_EXTENSION_CREATING_ERROR = "Error! 'Microsoft.Flux' extension is currently installing on the cluster. Unable to proceed with Flux v2 configuration install." FLUX_EXTENSION_CREATING_HELP = "Try again in a few minutes when the 'Microsoft.Flux' extension installation has completed." -HTTP_URL_NO_AUTH_WARNING = "Warning! https url is being used without https auth params, ensure the repository url provided is not a private repo" - NO_KUSTOMIZATIONS_WARNING = "Warning! No kustomizations were specified for this configuration. A kustomization will be generated with the default name 'kustomization-1'." DEFAULT_KUSTOMIZATION_NAME = "kustomization-1" diff --git a/src/k8s-configuration/azext_k8s_configuration/format.py b/src/k8s-configuration/azext_k8s_configuration/format.py index 01d729e7244..a7477a60bc5 100644 --- a/src/k8s-configuration/azext_k8s_configuration/format.py +++ b/src/k8s-configuration/azext_k8s_configuration/format.py @@ -44,7 +44,8 @@ def __get_fluxconfig_table_row(result): ("scope", result["scope"]), ("provisioningState", result["provisioningState"]), ("complianceState", result["complianceState"]), - ("lastSourceUpdatedAt", result["lastSourceUpdatedAt"]), + ("statusUpdatedAt", result["statusUpdatedAt"]), + ("sourceUpdatedAt", result["sourceUpdatedAt"]), ] ) @@ -58,16 +59,11 @@ def fluxconfig_kustomization_show_table_format(results): def __get_fluxconfig_kustomization_table_row(key, value): - deps = [] - for dep in value.get("dependsOn") or []: - if dep.get("kustomizationName"): - deps.append(dep["kustomizationName"]) - return OrderedDict( [ ("name", key), ("path", value["path"]), - ("dependsOn", ",".join(deps)), + ("dependsOn", ",".join(value.get("dependsOn") or [])), ("syncInterval", format_duration(value["syncIntervalInSeconds"])), ("timeout", format_duration(value["timeoutInSeconds"])), ("prune", value["prune"]), diff --git a/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py b/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py index 7b86396501b..e0a99697efa 100644 --- a/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py +++ b/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py @@ -46,19 +46,19 @@ validate_url_with_params, ) from .. import consts -from ..vendored_sdks.v2022_01_01_preview.models import ( +from ..vendored_sdks.v2022_03_01.models import ( FluxConfiguration, FluxConfigurationPatch, GitRepositoryDefinition, GitRepositoryPatchDefinition, BucketDefinition, + BucketPatchDefinition, RepositoryRefDefinition, KustomizationDefinition, KustomizationPatchDefinition, - DependsOnDefinition, SourceKindType, ) -from ..vendored_sdks.v2021_09_01.models import Extension, Identity +from ..vendored_sdks.v2022_03_01.models import Extension, Identity logger = get_logger(__name__) @@ -384,17 +384,10 @@ def create_kustomization( consts.CREATE_KUSTOMIZATION_EXIST_HELP, ) - # Add the dependencies in their model to the kustomization - model_dependencies = None - if dependencies: - model_dependencies = [] - for dep in parse_dependencies(dependencies): - model_dependencies.append(DependsOnDefinition(kustomization_name=dep)) - kustomization = { kustomization_name: KustomizationPatchDefinition( path=path, - depends_on=model_dependencies, + depends_on=parse_dependencies(dependencies), timeout_in_seconds=parse_duration(timeout), sync_interval_in_seconds=parse_duration(sync_interval), retry_interval_in_seconds=parse_duration(retry_interval), @@ -451,17 +444,10 @@ def update_kustomization( consts.UPDATE_KUSTOMIZATION_NO_EXIST_HELP, ) - # Add the dependencies in their model to the kustomization - model_dependencies = None - if dependencies: - model_dependencies = [] - for dep in parse_dependencies(dependencies): - model_dependencies.append(DependsOnDefinition(kustomization_name=dep)) - kustomization = { kustomization_name: KustomizationPatchDefinition( path=path, - depends_on=model_dependencies, + depends_on=parse_dependencies(dependencies), timeout_in_seconds=parse_duration(timeout), sync_interval_in_seconds=parse_duration(sync_interval), retry_interval_in_seconds=parse_duration(retry_interval), @@ -1015,7 +1001,7 @@ def generate_patch_update_func(self, swapped_kind): def bucket_patch_updater(config): if any(kwarg is not None for kwarg in self.kwargs.values()): - config.bucket = BucketDefinition( + config.bucket = BucketPatchDefinition( url=self.url, bucket_name=self.bucket_name, timeout_in_seconds=parse_duration(self.timeout), diff --git a/src/k8s-configuration/azext_k8s_configuration/providers/SourceControlConfigurationProvider.py b/src/k8s-configuration/azext_k8s_configuration/providers/SourceControlConfigurationProvider.py index 7209a12730b..7687a61e8d4 100644 --- a/src/k8s-configuration/azext_k8s_configuration/providers/SourceControlConfigurationProvider.py +++ b/src/k8s-configuration/azext_k8s_configuration/providers/SourceControlConfigurationProvider.py @@ -20,7 +20,7 @@ ) from .. import consts -from ..vendored_sdks.v2021_03_01.models import ( +from ..vendored_sdks.v2022_03_01.models import ( HelmOperatorProperties, SourceControlConfiguration, ) diff --git a/src/k8s-configuration/azext_k8s_configuration/tests/latest/recordings/test_k8s_configuration_success.yaml b/src/k8s-configuration/azext_k8s_configuration/tests/latest/recordings/test_k8s_configuration_success.yaml index 41ea5533cf5..4298d1af54b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/tests/latest/recordings/test_k8s_configuration_success.yaml +++ b/src/k8s-configuration/azext_k8s_configuration/tests/latest/recordings/test_k8s_configuration_success.yaml @@ -13,17 +13,73 @@ interactions: ParameterSetName: - -g -c -n --cluster-type User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '2448' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 18:25:52 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-configuration show + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2022-03-01 response: body: string: '{"error":{"code":"ResourceNotFound","message":"SourceControlConfiguration with name ''test-config'' not found."}}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: @@ -31,7 +87,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:43 GMT + - Tue, 08 Mar 2022 18:25:53 GMT expires: - '-1' pragma: @@ -59,34 +115,34 @@ interactions: --operator-params --git-readonly --ssh-private-key --ssh-known-hosts --enable-helm-operator --helm-operator-chart-version --helm-operator-params --set git.ssh.secretName User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.9.6 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East - US","West Europe","West Central US","West US 2","South Central US","East US - 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central - US","North Central US","West US","Korea Central","East Asia","Japan East","East - US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East - US","West Europe","West Central US","West US 2","South Central US","East US - 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central - US","North Central US","West US","Korea Central","East Asia","Japan East","East - US 2 EUAP"],"apiVersions":["2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, - SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East - US 2 EUAP","East US","West Europe","West Central US","West US 2","South Central + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central US","North Central US","West US","Korea Central","East Asia","Japan - East"],"apiVersions":["2021-06-01-preview"],"defaultApiVersion":"2021-06-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' headers: cache-control: - no-cache content-length: - - '2268' + - '2448' content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:44 GMT + - Tue, 08 Mar 2022 18:25:53 GMT expires: - '-1' pragma: @@ -127,29 +183,30 @@ interactions: --operator-params --git-readonly --ssh-private-key --ssh-known-hosts --enable-helm-operator --helm-operator-chart-version --helm-operator-params --set git.ssh.secretName User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2022-03-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config","name":"test-config","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set - git.ssh.secretName=gitops-privatekey-test-config-name --set tillerNamespace=kube-system"},"repositoryUrl":"git://github.com/anubhav929/flux-get-started","operatorInstanceName":"test-config-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":"Z2l0b3BzLWJpdGJ1Y2tldC10ZXN0LXNlcnZlci5lYXN0dXMuY2xvdWRhcHAuYXp1cmUuY29tIHNzaC1yc2EgQUFBQUIzTnphQzF5YzJFQUFBQURBUUFCQUFBQkFRQytNT0w3bjk2aGs3emVmMDNwak9vMGF3UENISkZ4NU04TjJ2L2tvODgvc202Y2VzOFljdnYyL0hoUlhRSFZHRUxqZjNuTXVGSVJPMEdMdTFabFNreGRUTUhGcXBxYzFjcUM2R3kveUJXRGM1SWFwWnJBMXFxeSsrZVdpelAzQXdMbWsrMUhXWGdtcHljZUtYNU9vd3VNT3cwd3RYRUdTcDhtVk0wV2VpUzEwWnZ5ZVVKK04zbkNvczMyWDhIeVpnc1pMUS9zSTB4NXN6ODQ2am5JZEFOckZsYU9MUTJ1ejRUa0M2ekNvd3lIdzlLWXJ5V2hJZDAraCt5SXQ5dUtqVHZsWFNpdm1ISjViZzdUWWlkbnFtbjI0UGE4WnFpbTE5UGszUjg0cW9qclVmYm1XT3VwUjdYNXZVVWZqYzhERFRxa3FnRmkxcWdVdE1mWGlMRXErZFVa","configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-09-08T19:26:46.585496+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-09-08T19:26:46.585496+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config","name":"test-config","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set + git.ssh.secretName=gitops-privatekey-test-config-name --set tillerNamespace=kube-system"},"repositoryUrl":"git://github.com/anubhav929/flux-get-started","operatorInstanceName":"test-config-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":"Z2l0b3BzLWJpdGJ1Y2tldC10ZXN0LXNlcnZlci5lYXN0dXMuY2xvdWRhcHAuYXp1cmUuY29tIHNzaC1yc2EgQUFBQUIzTnphQzF5YzJFQUFBQURBUUFCQUFBQkFRQytNT0w3bjk2aGs3emVmMDNwak9vMGF3UENISkZ4NU04TjJ2L2tvODgvc202Y2VzOFljdnYyL0hoUlhRSFZHRUxqZjNuTXVGSVJPMEdMdTFabFNreGRUTUhGcXBxYzFjcUM2R3kveUJXRGM1SWFwWnJBMXFxeSsrZVdpelAzQXdMbWsrMUhXWGdtcHljZUtYNU9vd3VNT3cwd3RYRUdTcDhtVk0wV2VpUzEwWnZ5ZVVKK04zbkNvczMyWDhIeVpnc1pMUS9zSTB4NXN6ODQ2am5JZEFOckZsYU9MUTJ1ejRUa0M2ekNvd3lIdzlLWXJ5V2hJZDAraCt5SXQ5dUtqVHZsWFNpdm1ISjViZzdUWWlkbnFtbjI0UGE4WnFpbTE5UGszUjg0cW9qclVmYm1XT3VwUjdYNXZVVWZqYzhERFRxa3FnRmkxcWdVdE1mWGlMRXErZFVa","configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2022-03-08T18:25:56.7211078+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2022-03-08T18:25:56.7211078+00:00"}}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: - - '1857' + - '1850' content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:46 GMT + - Tue, 08 Mar 2022 18:25:55 GMT expires: - '-1' location: - - file:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config + - file:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config pragma: - no-cache strict-transport-security: @@ -175,25 +232,81 @@ interactions: ParameterSetName: - -g -c -n --cluster-type User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config","name":"test-config","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set - git.ssh.secretName=gitops-privatekey-test-config-name --set tillerNamespace=kube-system"},"repositoryUrl":"git://github.com/anubhav929/flux-get-started","operatorInstanceName":"test-config-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":"Z2l0b3BzLWJpdGJ1Y2tldC10ZXN0LXNlcnZlci5lYXN0dXMuY2xvdWRhcHAuYXp1cmUuY29tIHNzaC1yc2EgQUFBQUIzTnphQzF5YzJFQUFBQURBUUFCQUFBQkFRQytNT0w3bjk2aGs3emVmMDNwak9vMGF3UENISkZ4NU04TjJ2L2tvODgvc202Y2VzOFljdnYyL0hoUlhRSFZHRUxqZjNuTXVGSVJPMEdMdTFabFNreGRUTUhGcXBxYzFjcUM2R3kveUJXRGM1SWFwWnJBMXFxeSsrZVdpelAzQXdMbWsrMUhXWGdtcHljZUtYNU9vd3VNT3cwd3RYRUdTcDhtVk0wV2VpUzEwWnZ5ZVVKK04zbkNvczMyWDhIeVpnc1pMUS9zSTB4NXN6ODQ2am5JZEFOckZsYU9MUTJ1ejRUa0M2ekNvd3lIdzlLWXJ5V2hJZDAraCt5SXQ5dUtqVHZsWFNpdm1ISjViZzdUWWlkbnFtbjI0UGE4WnFpbTE5UGszUjg0cW9qclVmYm1XT3VwUjdYNXZVVWZqYzhERFRxa3FnRmkxcWdVdE1mWGlMRXErZFVa","configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-09-08T19:26:46.585496+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-09-08T19:26:46.585496+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '2448' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 18:25:56 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-configuration show + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2022-03-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config","name":"test-config","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set + git.ssh.secretName=gitops-privatekey-test-config-name --set tillerNamespace=kube-system"},"repositoryUrl":"git://github.com/anubhav929/flux-get-started","operatorInstanceName":"test-config-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":"Z2l0b3BzLWJpdGJ1Y2tldC10ZXN0LXNlcnZlci5lYXN0dXMuY2xvdWRhcHAuYXp1cmUuY29tIHNzaC1yc2EgQUFBQUIzTnphQzF5YzJFQUFBQURBUUFCQUFBQkFRQytNT0w3bjk2aGs3emVmMDNwak9vMGF3UENISkZ4NU04TjJ2L2tvODgvc202Y2VzOFljdnYyL0hoUlhRSFZHRUxqZjNuTXVGSVJPMEdMdTFabFNreGRUTUhGcXBxYzFjcUM2R3kveUJXRGM1SWFwWnJBMXFxeSsrZVdpelAzQXdMbWsrMUhXWGdtcHljZUtYNU9vd3VNT3cwd3RYRUdTcDhtVk0wV2VpUzEwWnZ5ZVVKK04zbkNvczMyWDhIeVpnc1pMUS9zSTB4NXN6ODQ2am5JZEFOckZsYU9MUTJ1ejRUa0M2ekNvd3lIdzlLWXJ5V2hJZDAraCt5SXQ5dUtqVHZsWFNpdm1ISjViZzdUWWlkbnFtbjI0UGE4WnFpbTE5UGszUjg0cW9qclVmYm1XT3VwUjdYNXZVVWZqYzhERFRxa3FnRmkxcWdVdE1mWGlMRXErZFVa","configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2022-03-08T18:25:56.7211078+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2022-03-08T18:25:56.7211078+00:00"}}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: - - '1857' + - '1850' content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:46 GMT + - Tue, 08 Mar 2022 18:25:58 GMT expires: - '-1' pragma: @@ -209,6 +322,61 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-configuration delete + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type -y + User-Agent: + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '2448' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 18:25:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK - request: body: null headers: @@ -225,16 +393,17 @@ interactions: ParameterSetName: - -g -c -n --cluster-type -y User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config?api-version=2022-03-01 response: body: string: '{"content":null,"statusCode":200,"headers":[],"version":"1.1","reasonPhrase":"OK","trailingHeaders":[],"requestMessage":null,"isSuccessStatusCode":true}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: @@ -242,7 +411,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:47 GMT + - Tue, 08 Mar 2022 18:25:59 GMT expires: - '-1' pragma: @@ -274,17 +443,73 @@ interactions: ParameterSetName: - -g -c -n --cluster-type User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '2448' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 18:25:59 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-configuration show + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2022-03-01 response: body: string: '{"error":{"code":"ResourceNotFound","message":"SourceControlConfiguration with name ''test-config2'' not found."}}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: @@ -292,7 +517,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:48 GMT + - Tue, 08 Mar 2022 18:26:01 GMT expires: - '-1' pragma: @@ -320,34 +545,34 @@ interactions: --operator-params --git-readonly --https-user --https-key --enable-helm-operator --helm-operator-chart-version --helm-operator-params --set tillerNamespace User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.9.6 (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East - US","West Europe","West Central US","West US 2","South Central US","East US - 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central - US","North Central US","West US","Korea Central","East Asia","Japan East","East - US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East - US","West Europe","West Central US","West US 2","South Central US","East US - 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central - US","North Central US","West US","Korea Central","East Asia","Japan East","East - US 2 EUAP"],"apiVersions":["2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, - SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East - US 2 EUAP","East US","West Europe","West Central US","West US 2","South Central + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central US","North Central US","West US","Korea Central","East Asia","Japan - East"],"apiVersions":["2021-06-01-preview"],"defaultApiVersion":"2021-06-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' headers: cache-control: - no-cache content-length: - - '2268' + - '2448' content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:49 GMT + - Tue, 08 Mar 2022 18:26:01 GMT expires: - '-1' pragma: @@ -366,9 +591,8 @@ interactions: "operatorNamespace": "test-config2-namespace", "operatorInstanceName": "test-config2-name", "operatorType": "flux", "operatorParams": "--git-readonly ", "configurationProtectedSettings": {"httpsUser": "ZmFrZS11c2VybmFtZQ==", "httpsKey": "ZmFrZXBhc3N3b3JkdGhhdGl3b3VsZHVzZWZvcmdpdGh1Yg=="}, - "operatorScope": "namespace", "sshKnownHostsContents": "", "enableHelmOperator": - true, "helmOperatorProperties": {"chartVersion": "1.2.0", "chartValues": "--set - tillerNamespace=kube-system"}}}' + "operatorScope": "namespace", "enableHelmOperator": true, "helmOperatorProperties": + {"chartVersion": "1.2.0", "chartValues": "--set tillerNamespace=kube-system"}}}' headers: Accept: - application/json @@ -379,7 +603,7 @@ interactions: Connection: - keep-alive Content-Length: - - '590' + - '561' Content-Type: - application/json ParameterSetName: @@ -387,29 +611,30 @@ interactions: --operator-params --git-readonly --https-user --https-key --enable-helm-operator --helm-operator-chart-version --helm-operator-params --set tillerNamespace User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2022-03-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2","name":"test-config2","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config2-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set - tillerNamespace=kube-system"},"repositoryUrl":"https://github.com/jonathan-innis/helm-operator-get-started-private.git","operatorInstanceName":"test-config2-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":"","configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-09-08T19:26:51.6588187+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-09-08T19:26:51.6588187+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2","name":"test-config2","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config2-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set + tillerNamespace=kube-system"},"repositoryUrl":"https://github.com/jonathan-innis/helm-operator-get-started-private.git","operatorInstanceName":"test-config2-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":null,"configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2022-03-08T18:26:03.7133511+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2022-03-08T18:26:03.7133511+00:00"}}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: - - '1250' + - '1243' content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:51 GMT + - Tue, 08 Mar 2022 18:26:03 GMT expires: - '-1' location: - - file:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2 + - file:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2 pragma: - no-cache strict-transport-security: @@ -435,25 +660,81 @@ interactions: ParameterSetName: - -g -c -n --cluster-type User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2","name":"test-config2","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config2-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set - tillerNamespace=kube-system"},"repositoryUrl":"https://github.com/jonathan-innis/helm-operator-get-started-private.git","operatorInstanceName":"test-config2-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":"","configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-09-08T19:26:51.6588187+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-09-08T19:26:51.6588187+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '2448' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 18:26:03 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-configuration show + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2022-03-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2","name":"test-config2","type":"Microsoft.KubernetesConfiguration/sourceControlConfigurations","properties":{"operatorNamespace":"test-config2-namespace","provisioningState":"Succeeded","complianceStatus":{"complianceState":"Pending","lastConfigApplied":"0001-01-01T00:00:00+00:00","message":"{\"OperatorMessage\":null,\"ClusterState\":null}","messageLevel":"Information"},"enableHelmOperator":true,"helmOperatorProperties":{"chartVersion":"1.2.0","chartValues":"--set + tillerNamespace=kube-system"},"repositoryUrl":"https://github.com/jonathan-innis/helm-operator-get-started-private.git","operatorInstanceName":"test-config2-name","operatorType":"Flux","operatorScope":"namespace","operatorParams":"--git-readonly","sshKnownHostsContents":null,"configurationProtectedSettings":{},"repositoryPublicKey":""},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2022-03-08T18:26:03.7133511+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2022-03-08T18:26:03.7133511+00:00"}}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: - - '1250' + - '1243' content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:52 GMT + - Tue, 08 Mar 2022 18:26:04 GMT expires: - '-1' pragma: @@ -469,6 +750,61 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-configuration delete + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type -y + User-Agent: + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.9.6 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + US","West Europe","West Central US","West US 2","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","East US 2 EUAP"],"apiVersions":["2021-09-01","2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"fluxConfigurations","locations":["East + US 2 EUAP","East US","West Europe","West Central US","West US 2","West US + 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia + East","France Central","Central US","North Central US","West US","Korea Central","East + Asia","Japan East"],"apiVersions":["2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-01-01-preview","capabilities":"SupportsExtension"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + headers: + cache-control: + - no-cache + content-length: + - '2448' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 18:26:05 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK - request: body: null headers: @@ -485,16 +821,17 @@ interactions: ParameterSetName: - -g -c -n --cluster-type -y User-Agent: - - AZURECLI/2.28.0 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.9.6 - (Windows-10-10.0.19043-SP0) + - AZURECLI/2.34.1 azsdk-python-azure-mgmt-kubernetesconfiguration/1.0.0 Python/3.9.6 + (Windows-10-10.0.22000-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_recordings_testing/providers/Microsoft.Kubernetes/connectedClusters/test-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2021-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/test-config2?api-version=2022-03-01 response: body: string: '{"content":null,"statusCode":200,"headers":[],"version":"1.1","reasonPhrase":"OK","trailingHeaders":[],"requestMessage":null,"isSuccessStatusCode":true}' headers: api-supported-versions: - - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview + - 2019-11-01-Preview, 2020-07-01-Preview, 2020-10-01-Preview, 2021-03-01, 2021-05-01-preview, + 2022-03-01 cache-control: - no-cache content-length: @@ -502,7 +839,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 08 Sep 2021 19:26:52 GMT + - Tue, 08 Mar 2022 18:26:06 GMT expires: - '-1' pragma: diff --git a/src/k8s-configuration/azext_k8s_configuration/tests/latest/test_kubernetesconfiguration_scenario.py b/src/k8s-configuration/azext_k8s_configuration/tests/latest/test_kubernetesconfiguration_scenario.py index e0e3b256d4e..09db7e3fc0e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/tests/latest/test_kubernetesconfiguration_scenario.py +++ b/src/k8s-configuration/azext_k8s_configuration/tests/latest/test_kubernetesconfiguration_scenario.py @@ -21,8 +21,8 @@ def test_k8s_configuration_success(self): # -------------------------------------------------------------------- self.kwargs.update({ 'name': 'test-config', - 'cluster_name': 'test-cluster', - 'rg': 'cli_recordings_testing', + 'cluster_name': 'arc-cluster', + 'rg': 'azurecli-tests', 'repo_url': 'git://github.com/anubhav929/flux-get-started', 'operator_instance_name': 'test-config-name', 'operator_namespace': 'test-config-namespace', @@ -83,8 +83,8 @@ def test_k8s_configuration_success(self): # -------------------------------------------------------------------- self.kwargs.update({ 'name': 'test-config2', - 'cluster_name': 'test-cluster', - 'rg': 'cli_recordings_testing', + 'cluster_name': 'arc-cluster', + 'rg': 'azurecli-tests', 'repo_url': 'https://github.com/jonathan-innis/helm-operator-get-started-private.git', 'operator_instance_name': 'test-config2-name', 'operator_namespace': 'test-config2-namespace', diff --git a/src/k8s-configuration/azext_k8s_configuration/utils.py b/src/k8s-configuration/azext_k8s_configuration/utils.py index d66271b2233..7999145934e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/utils.py +++ b/src/k8s-configuration/azext_k8s_configuration/utils.py @@ -72,6 +72,8 @@ def read_key_file(path, strip_newline=False): def parse_dependencies(depends_on): + if not depends_on: + return None depends_on = depends_on.strip() if depends_on[0] == "[": depends_on = depends_on[1:-1] diff --git a/src/k8s-configuration/azext_k8s_configuration/validators.py b/src/k8s-configuration/azext_k8s_configuration/validators.py index acefb4ab14a..ddf7228eefa 100644 --- a/src/k8s-configuration/azext_k8s_configuration/validators.py +++ b/src/k8s-configuration/azext_k8s_configuration/validators.py @@ -189,8 +189,6 @@ def validate_url_with_params( consts.KNOWN_HOSTS_WITH_HTTP_URL_ERROR, consts.KNOWN_HOSTS_WITH_HTTP_URL_HELP, ) - if not (https_user and https_key) and scheme == "https": - logger.warning(consts.HTTP_URL_NO_AUTH_WARNING) else: if https_user or https_key: raise MutuallyExclusiveArgumentError( diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_configuration.py index 6ecda0480c4..6cd5f3b0fb0 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_source_control_configuration_client.py index 1743fa49f4d..a75870fe68b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_source_control_configuration_client.py @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -56,12 +55,15 @@ class SourceControlConfigurationClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-09-01' + DEFAULT_API_VERSION = '2022-03-01' _PROFILE_TAG = "azure.mgmt.kubernetesconfiguration.SourceControlConfigurationClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'source_control_configurations': '2021-03-01', + 'cluster_extension_type': '2022-01-01-preview', + 'cluster_extension_types': '2022-01-01-preview', + 'extension_type_versions': '2022-01-01-preview', + 'location_extension_types': '2022-01-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -71,12 +73,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - if not base_url: - base_url = 'https://management.azure.com' self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(SourceControlConfigurationClient, self).__init__( @@ -99,6 +99,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-09-01: :mod:`v2021_09_01.models` * 2021-11-01-preview: :mod:`v2021_11_01_preview.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` + * 2022-03-01: :mod:`v2022_03_01.models` """ if api_version == '2020-07-01-preview': from .v2020_07_01_preview import models @@ -121,6 +122,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-01-01-preview': from .v2022_01_01_preview import models return models + elif api_version == '2022-03-01': + from .v2022_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -189,6 +193,7 @@ def extensions(self): * 2021-09-01: :class:`ExtensionsOperations` * 2021-11-01-preview: :class:`ExtensionsOperations` * 2022-01-01-preview: :class:`ExtensionsOperations` + * 2022-03-01: :class:`ExtensionsOperations` """ api_version = self._get_api_version('extensions') if api_version == '2020-07-01-preview': @@ -201,6 +206,8 @@ def extensions(self): from .v2021_11_01_preview.operations import ExtensionsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import ExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -211,12 +218,15 @@ def flux_config_operation_status(self): * 2021-11-01-preview: :class:`FluxConfigOperationStatusOperations` * 2022-01-01-preview: :class:`FluxConfigOperationStatusOperations` + * 2022-03-01: :class:`FluxConfigOperationStatusOperations` """ api_version = self._get_api_version('flux_config_operation_status') if api_version == '2021-11-01-preview': from .v2021_11_01_preview.operations import FluxConfigOperationStatusOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import FluxConfigOperationStatusOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import FluxConfigOperationStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'flux_config_operation_status'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -227,12 +237,15 @@ def flux_configurations(self): * 2021-11-01-preview: :class:`FluxConfigurationsOperations` * 2022-01-01-preview: :class:`FluxConfigurationsOperations` + * 2022-03-01: :class:`FluxConfigurationsOperations` """ api_version = self._get_api_version('flux_configurations') if api_version == '2021-11-01-preview': from .v2021_11_01_preview.operations import FluxConfigurationsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import FluxConfigurationsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import FluxConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'flux_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -264,6 +277,7 @@ def operation_status(self): * 2021-09-01: :class:`OperationStatusOperations` * 2021-11-01-preview: :class:`OperationStatusOperations` * 2022-01-01-preview: :class:`OperationStatusOperations` + * 2022-03-01: :class:`OperationStatusOperations` """ api_version = self._get_api_version('operation_status') if api_version == '2021-05-01-preview': @@ -274,6 +288,8 @@ def operation_status(self): from .v2021_11_01_preview.operations import OperationStatusOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import OperationStatusOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import OperationStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'operation_status'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -289,6 +305,7 @@ def operations(self): * 2021-09-01: :class:`Operations` * 2021-11-01-preview: :class:`Operations` * 2022-01-01-preview: :class:`Operations` + * 2022-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2020-07-01-preview': @@ -305,6 +322,8 @@ def operations(self): from .v2021_11_01_preview.operations import Operations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import Operations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -319,6 +338,7 @@ def source_control_configurations(self): * 2021-05-01-preview: :class:`SourceControlConfigurationsOperations` * 2021-11-01-preview: :class:`SourceControlConfigurationsOperations` * 2022-01-01-preview: :class:`SourceControlConfigurationsOperations` + * 2022-03-01: :class:`SourceControlConfigurationsOperations` """ api_version = self._get_api_version('source_control_configurations') if api_version == '2020-07-01-preview': @@ -333,6 +353,8 @@ def source_control_configurations(self): from .v2021_11_01_preview.operations import SourceControlConfigurationsOperations as OperationClass elif api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import SourceControlConfigurationsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import SourceControlConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'source_control_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_version.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_version.py index b538e1b4f03..c47f66669f1 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_version.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" \ No newline at end of file +VERSION = "1.0.0" diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_configuration.py index e86e06bef71..dfeb48eb057 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_source_control_configuration_client.py index 97f3e6688eb..ed320e3b24c 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/aio/_source_control_configuration_client.py @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -54,12 +54,15 @@ class SourceControlConfigurationClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-09-01' + DEFAULT_API_VERSION = '2022-03-01' _PROFILE_TAG = "azure.mgmt.kubernetesconfiguration.SourceControlConfigurationClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'source_control_configurations': '2021-03-01', + 'cluster_extension_type': '2022-01-01-preview', + 'cluster_extension_types': '2022-01-01-preview', + 'extension_type_versions': '2022-01-01-preview', + 'location_extension_types': '2022-01-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -69,12 +72,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(SourceControlConfigurationClient, self).__init__( @@ -97,6 +98,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-09-01: :mod:`v2021_09_01.models` * 2021-11-01-preview: :mod:`v2021_11_01_preview.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` + * 2022-03-01: :mod:`v2022_03_01.models` """ if api_version == '2020-07-01-preview': from ..v2020_07_01_preview import models @@ -119,6 +121,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview import models return models + elif api_version == '2022-03-01': + from ..v2022_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -187,6 +192,7 @@ def extensions(self): * 2021-09-01: :class:`ExtensionsOperations` * 2021-11-01-preview: :class:`ExtensionsOperations` * 2022-01-01-preview: :class:`ExtensionsOperations` + * 2022-03-01: :class:`ExtensionsOperations` """ api_version = self._get_api_version('extensions') if api_version == '2020-07-01-preview': @@ -199,6 +205,8 @@ def extensions(self): from ..v2021_11_01_preview.aio.operations import ExtensionsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import ExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -209,12 +217,15 @@ def flux_config_operation_status(self): * 2021-11-01-preview: :class:`FluxConfigOperationStatusOperations` * 2022-01-01-preview: :class:`FluxConfigOperationStatusOperations` + * 2022-03-01: :class:`FluxConfigOperationStatusOperations` """ api_version = self._get_api_version('flux_config_operation_status') if api_version == '2021-11-01-preview': from ..v2021_11_01_preview.aio.operations import FluxConfigOperationStatusOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import FluxConfigOperationStatusOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import FluxConfigOperationStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'flux_config_operation_status'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -225,12 +236,15 @@ def flux_configurations(self): * 2021-11-01-preview: :class:`FluxConfigurationsOperations` * 2022-01-01-preview: :class:`FluxConfigurationsOperations` + * 2022-03-01: :class:`FluxConfigurationsOperations` """ api_version = self._get_api_version('flux_configurations') if api_version == '2021-11-01-preview': from ..v2021_11_01_preview.aio.operations import FluxConfigurationsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import FluxConfigurationsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import FluxConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'flux_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -262,6 +276,7 @@ def operation_status(self): * 2021-09-01: :class:`OperationStatusOperations` * 2021-11-01-preview: :class:`OperationStatusOperations` * 2022-01-01-preview: :class:`OperationStatusOperations` + * 2022-03-01: :class:`OperationStatusOperations` """ api_version = self._get_api_version('operation_status') if api_version == '2021-05-01-preview': @@ -272,6 +287,8 @@ def operation_status(self): from ..v2021_11_01_preview.aio.operations import OperationStatusOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import OperationStatusOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import OperationStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'operation_status'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -287,6 +304,7 @@ def operations(self): * 2021-09-01: :class:`Operations` * 2021-11-01-preview: :class:`Operations` * 2022-01-01-preview: :class:`Operations` + * 2022-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2020-07-01-preview': @@ -303,6 +321,8 @@ def operations(self): from ..v2021_11_01_preview.aio.operations import Operations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -317,6 +337,7 @@ def source_control_configurations(self): * 2021-05-01-preview: :class:`SourceControlConfigurationsOperations` * 2021-11-01-preview: :class:`SourceControlConfigurationsOperations` * 2022-01-01-preview: :class:`SourceControlConfigurationsOperations` + * 2022-03-01: :class:`SourceControlConfigurationsOperations` """ api_version = self._get_api_version('source_control_configurations') if api_version == '2020-07-01-preview': @@ -331,6 +352,8 @@ def source_control_configurations(self): from ..v2021_11_01_preview.aio.operations import SourceControlConfigurationsOperations as OperationClass elif api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import SourceControlConfigurationsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import SourceControlConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'source_control_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/models.py index c82fe8f439c..c9c8d2ae160 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/models.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/models.py @@ -4,5 +4,5 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2021_03_01.models import * -from .v2021_09_01.models import * +from .v2022_01_01_preview.models import * +from .v2022_03_01.models import * diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_configuration.py index 89bdc90391d..a175e772c24 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_source_control_configuration_client.py index 71f3974f333..4a2066e60af 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_source_control_configuration_client.py @@ -6,84 +6,88 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .operations import ExtensionsOperations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.Operations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.ExtensionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_configuration.py index e15dc551cae..5d42c644d80 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_source_control_configuration_client.py index a03dc102973..786354552c0 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/_source_control_configuration_client.py @@ -6,80 +6,88 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .operations import ExtensionsOperations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.Operations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.ExtensionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_extensions_operations.py index e92980035ad..2cb12620a0e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_extensions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extensions_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -60,13 +66,15 @@ async def create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties necessary to Create an Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -77,41 +85,31 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension_instance, 'ExtensionInstance') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -120,8 +118,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,7 +141,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -155,36 +157,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -193,8 +185,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -214,13 +209,15 @@ async def update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties to Update in the Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -231,41 +228,31 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -274,8 +261,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -295,7 +285,8 @@ async def delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -310,36 +301,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,6 +328,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -364,12 +347,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionInstancesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] + :return: An iterator like instance of either ExtensionInstancesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstancesList"] @@ -377,38 +363,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionInstancesList', pipeline_response) + deserialized = self._deserialize("ExtensionInstancesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,12 +406,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_operations.py index b9e2205f961..15d34648a9c 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py index 116ecb3713e..540d16d33ae 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -303,24 +293,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/__init__.py index 5d3f8aea197..70c78dcb2d4 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/__init__.py @@ -6,50 +6,28 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ComplianceStatus - from ._models_py3 import ConfigurationIdentity - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import ExtensionInstance - from ._models_py3 import ExtensionInstanceUpdate - from ._models_py3 import ExtensionInstancesList - from ._models_py3 import ExtensionStatus - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Result - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ConfigurationIdentity # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ExtensionInstance # type: ignore - from ._models import ExtensionInstanceUpdate # type: ignore - from ._models import ExtensionInstancesList # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ComplianceStatus +from ._models_py3 import ConfigurationIdentity +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtensionInstance +from ._models_py3 import ExtensionInstanceUpdate +from ._models_py3 import ExtensionInstancesList +from ._models_py3 import ExtensionStatus +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Result +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ComplianceStateType, diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models.py deleted file mode 100644 index ef31b453ddc..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models.py +++ /dev/null @@ -1,817 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ConfigurationIdentity(msrest.serialization.Model): - """Identity for the managed cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity which is used by the - configuration. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity which is used by the - configuration. - :vartype tenant_id: str - :param type: The type of identity used for the configuration. Type 'SystemAssigned' will use an - implicitly created identity. Type 'None' will not use Managed Identity for the configuration. - Possible values include: "SystemAssigned", "None". - :type type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error definition. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class Resource(msrest.serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = kwargs.get('system_data', None) - - -class ProxyResource(Resource): - """ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ExtensionInstance(ProxyResource): - """The Extension Instance object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension instance, if it is 'pinned' to a - specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension instance is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - instance of the extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this instance of the extension. - :type configuration_protected_settings: dict[str, str] - :ivar install_state: Status of installation of this instance of the extension. Possible values - include: "Pending", "Installed", "Failed". - :vartype install_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.InstallStateType - :param statuses: Status from this instance of the extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] - :ivar creation_time: DateLiteral (per ISO8601) noting the time the resource was created by the - client (user). - :vartype creation_time: str - :ivar last_modified_time: DateLiteral (per ISO8601) noting the time the resource was modified - by the client (user). - :vartype last_modified_time: str - :ivar last_status_time: DateLiteral (per ISO8601) noting the time of last status from the - agent. - :vartype last_status_time: str - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - :param identity: The identity of the configuration. - :type identity: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'install_state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'last_status_time': {'readonly': True}, - 'error_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'install_state': {'key': 'properties.installState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, - 'last_status_time': {'key': 'properties.lastStatusTime', 'type': 'str'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDefinition'}, - 'identity': {'key': 'properties.identity', 'type': 'ConfigurationIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionInstance, self).__init__(**kwargs) - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.install_state = None - self.statuses = kwargs.get('statuses', None) - self.creation_time = None - self.last_modified_time = None - self.last_status_time = None - self.error_info = None - self.identity = kwargs.get('identity', None) - - -class ExtensionInstancesList(msrest.serialization.Model): - """Result of the request to list Extension Instances. It contains a list of ExtensionInstance objects 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. - - :ivar value: List of Extension Instances within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance] - :ivar next_link: URL to get the next set of extension instance objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionInstance]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionInstancesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionInstanceUpdate(msrest.serialization.Model): - """Update Extension Instance request object. - - :param auto_upgrade_minor_version: Flag to note if this instance participates in Extension - Lifecycle Management or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version number of extension, to 'pin' to a specific version. - autoUpgradeMinorVersion must be 'false'. - :type version: str - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionInstanceUpdate, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - - -class ExtensionStatus(msrest.serialization.Model): - """Status from this instance of the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of this instance of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension instance. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - -class Scope(msrest.serialization.Model): - """Scope of the extensionInstance. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extensionInstance is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extensionInstance is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extensionInstance. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Namespace. - - :param target_namespace: Namespace where the extensionInstance will be created for an Namespace - scoped extensionInstance. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_by: A string identifier for the identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource: user, application, - managedIdentity, key. - :vartype created_by_type: str - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: A string identifier for the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource: user, - application, managedIdentity, key. - :vartype last_modified_by_type: str - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _validation = { - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - } - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = None - self.created_by_type = None - self.created_at = None - self.last_modified_by = None - self.last_modified_by_type = None - self.last_modified_at = None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models_py3.py index 7d8c10c5306..d28c93715ed 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_models_py3.py @@ -24,13 +24,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.MessageLevelType """ @@ -53,6 +53,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -71,10 +81,10 @@ class ConfigurationIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id of the system assigned identity which is used by the configuration. :vartype tenant_id: str - :param type: The type of identity used for the configuration. Type 'SystemAssigned' will use an + :ivar type: The type of identity used for the configuration. Type 'SystemAssigned' will use an implicitly created identity. Type 'None' will not use Managed Identity for the configuration. Possible values include: "SystemAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType """ @@ -95,6 +105,13 @@ def __init__( type: Optional[Union[str, "ResourceIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of identity used for the configuration. Type 'SystemAssigned' will use + an implicitly created identity. Type 'None' will not use Managed Identity for the + configuration. Possible values include: "SystemAssigned", "None". + :paramtype type: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType + """ super(ConfigurationIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -106,11 +123,11 @@ class ErrorDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Service specific error code which serves as the substatus for the HTTP + :ivar code: Required. Service specific error code which serves as the substatus for the HTTP error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :vartype code: str + :ivar message: Required. Description of the error. + :vartype message: str """ _validation = { @@ -130,6 +147,13 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Service specific error code which serves as the substatus for the HTTP + error code. + :paramtype code: str + :keyword message: Required. Description of the error. + :paramtype message: str + """ super(ErrorDefinition, self).__init__(**kwargs) self.code = code self.message = message @@ -156,6 +180,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.error = None @@ -171,9 +197,9 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -195,6 +221,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -213,9 +245,9 @@ class ProxyResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -237,6 +269,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + """ super(ProxyResource, self).__init__(system_data=system_data, **kwargs) @@ -251,36 +289,36 @@ class ExtensionInstance(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade of + minor version, or not. + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension instance participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension instance, if it is 'pinned' to a + :vartype release_train: str + :ivar version: Version of the extension for this extension instance, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension instance is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension instance is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this instance of the extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this instance of the extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar install_state: Status of installation of this instance of the extension. Possible values include: "Pending", "Installed", "Failed". :vartype install_state: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.InstallStateType - :param statuses: Status from this instance of the extension. - :type statuses: + :ivar statuses: Status from this instance of the extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] :ivar creation_time: DateLiteral (per ISO8601) noting the time the resource was created by the client (user). @@ -294,8 +332,8 @@ class ExtensionInstance(ProxyResource): :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - :param identity: The identity of the configuration. - :type identity: + :ivar identity: The identity of the configuration. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity """ @@ -346,6 +384,39 @@ def __init__( identity: Optional["ConfigurationIdentity"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade + of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension instance participates in for auto-upgrade + (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension instance, if it is 'pinned' to a + specific version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension instance is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this instance of the extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this instance of the extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this instance of the extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] + :keyword identity: The identity of the configuration. + :paramtype identity: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity + """ super(ExtensionInstance, self).__init__(system_data=system_data, **kwargs) self.extension_type = extension_type self.auto_upgrade_minor_version = auto_upgrade_minor_version @@ -389,6 +460,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionInstancesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -397,15 +470,15 @@ def __init__( class ExtensionInstanceUpdate(msrest.serialization.Model): """Update Extension Instance request object. - :param auto_upgrade_minor_version: Flag to note if this instance participates in Extension + :ivar auto_upgrade_minor_version: Flag to note if this instance participates in Extension Lifecycle Management or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension instance participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version number of extension, to 'pin' to a specific version. + :vartype release_train: str + :ivar version: Version number of extension, to 'pin' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str + :vartype version: str """ _attribute_map = { @@ -422,6 +495,17 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this instance participates in Extension + Lifecycle Management or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension instance participates in for auto-upgrade + (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version number of extension, to 'pin' to a specific version. + autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + """ super(ExtensionInstanceUpdate, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -431,17 +515,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from this instance of the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of this instance of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of this instance of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension instance. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension instance. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -462,6 +546,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of this instance of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension instance. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -473,10 +571,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -491,6 +589,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -501,10 +605,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -527,6 +631,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -536,14 +647,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -562,6 +673,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -574,8 +695,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -596,6 +717,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -604,8 +730,8 @@ def __init__( class Result(msrest.serialization.Model): """Sample result definition. - :param sample_property: Sample property of type string. - :type sample_property: str + :ivar sample_property: Sample property of type string. + :vartype sample_property: str """ _attribute_map = { @@ -618,6 +744,10 @@ def __init__( sample_property: Optional[str] = None, **kwargs ): + """ + :keyword sample_property: Sample property of type string. + :paramtype sample_property: str + """ super(Result, self).__init__(**kwargs) self.sample_property = sample_property @@ -625,10 +755,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extensionInstance. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extensionInstance is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extensionInstance is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extensionInstance is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extensionInstance is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -643,6 +774,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extensionInstance is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extensionInstance is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -651,9 +789,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extensionInstance is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extensionInstance. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -666,6 +804,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extensionInstance. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -673,9 +816,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extensionInstance is Namespace. - :param target_namespace: Namespace where the extensionInstance will be created for an Namespace + :ivar target_namespace: Namespace where the extensionInstance will be created for an Namespace scoped extensionInstance. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -688,6 +831,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extensionInstance will be created for an + Namespace scoped extensionInstance. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -703,39 +851,39 @@ class SourceControlConfiguration(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -791,6 +939,40 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(system_data=system_data, **kwargs) self.repository_url = repository_url self.operator_namespace = operator_namespace @@ -833,6 +1015,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -881,6 +1065,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemData, self).__init__(**kwargs) self.created_by = None self.created_by_type = None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_source_control_configuration_client_enums.py index 825cfccadd1..bae6382fbce 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/models/_source_control_configuration_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -36,17 +21,17 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class InstallStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of installation of this instance of the extension. """ @@ -54,7 +39,7 @@ class InstallStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -62,7 +47,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -70,20 +55,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ @@ -93,7 +78,7 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the configuration. Type 'SystemAssigned' will use an implicitly created identity. Type 'None' will not use Managed Identity for the configuration. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_extensions_operations.py index c3e2b0cf5f4..f0a15e102ca 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_extensions_operations.py @@ -5,23 +5,247 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -45,17 +269,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - extension_instance, # type: "_models.ExtensionInstance" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionInstance" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + extension_instance: "_models.ExtensionInstance", + **kwargs: Any + ) -> "_models.ExtensionInstance": """Create a new Kubernetes Cluster Extension Instance. :param resource_group_name: The name of the resource group. @@ -65,13 +289,15 @@ def create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties necessary to Create an Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -82,41 +308,31 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension_instance, 'ExtensionInstance') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -125,18 +341,20 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionInstance" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any + ) -> "_models.ExtensionInstance": """Gets details of the Kubernetes Cluster Extension Instance. :param resource_group_name: The name of the resource group. @@ -146,7 +364,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -161,36 +380,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -199,19 +408,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - extension_instance, # type: "_models.ExtensionInstanceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionInstance" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + extension_instance: "_models.ExtensionInstanceUpdate", + **kwargs: Any + ) -> "_models.ExtensionInstance": """Update an existing Kubernetes Cluster Extension Instance. :param resource_group_name: The name of the resource group. @@ -221,13 +432,15 @@ def update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties to Update in the Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -238,41 +451,31 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -281,18 +484,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any + ) -> None: """Delete a Kubernetes Cluster Extension Instance. This will cause the Agent to Uninstall the extension instance from the cluster. @@ -303,7 +508,8 @@ def delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -318,36 +524,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,15 +551,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionInstancesList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionInstancesList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -373,12 +570,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionInstancesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] + :return: An iterator like instance of either ExtensionInstancesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstancesList"] @@ -386,38 +586,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionInstancesList', pipeline_response) + deserialized = self._deserialize("ExtensionInstancesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,12 +629,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_operations.py index 1fe1fbf39b1..3e405e2ae48 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_source_control_configurations_operations.py index d192efa6d03..3a863680448 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_07_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,24 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_configuration.py index d5969e53212..7167f9bec31 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_source_control_configuration_client.py index c079c472da6..435ce16a3a2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_source_control_configuration_client.py @@ -6,79 +6,84 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_configuration.py index 8002c1a9fbc..2ea6b77035b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_source_control_configuration_client.py index 1e3021bd71a..24c6800aa80 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/_source_control_configuration_client.py @@ -6,75 +6,84 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_operations.py index 3f70e7e1e81..d10b2c945f2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py index 52063acf78e..1ff137c7cc0 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -303,24 +293,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/__init__.py index b1e23c9e1d7..f851a5fd806 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/__init__.py @@ -6,34 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ComplianceStatus - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Result - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Result +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ComplianceStateType, diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models.py deleted file mode 100644 index 12ebfd16f6d..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models.py +++ /dev/null @@ -1,506 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error definition. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ErrorDefinition - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class Resource(msrest.serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = kwargs.get('system_data', None) - - -class ProxyResource(Resource): - """ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_by: A string identifier for the identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource: user, application, - managedIdentity, key. - :vartype created_by_type: str - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: A string identifier for the identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource: user, - application, managedIdentity, key. - :vartype last_modified_by_type: str - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _validation = { - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - } - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = None - self.created_by_type = None - self.created_at = None - self.last_modified_by = None - self.last_modified_by_type = None - self.last_modified_at = None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models_py3.py index ed2e27c2b8f..b3ea2a3dcc4 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_models_py3.py @@ -24,13 +24,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.MessageLevelType """ @@ -53,6 +53,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -65,11 +75,11 @@ class ErrorDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Service specific error code which serves as the substatus for the HTTP + :ivar code: Required. Service specific error code which serves as the substatus for the HTTP error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :vartype code: str + :ivar message: Required. Description of the error. + :vartype message: str """ _validation = { @@ -89,6 +99,13 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Service specific error code which serves as the substatus for the HTTP + error code. + :paramtype code: str + :keyword message: Required. Description of the error. + :paramtype message: str + """ super(ErrorDefinition, self).__init__(**kwargs) self.code = code self.message = message @@ -115,6 +132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.error = None @@ -122,10 +141,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -140,6 +159,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -156,9 +181,9 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData """ _validation = { @@ -180,6 +205,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,9 +229,9 @@ class ProxyResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData """ _validation = { @@ -222,6 +253,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + """ super(ProxyResource, self).__init__(system_data=system_data, **kwargs) @@ -230,10 +267,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -256,6 +293,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -265,14 +309,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -291,6 +335,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -303,8 +357,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -325,6 +379,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -333,8 +392,8 @@ def __init__( class Result(msrest.serialization.Model): """Sample result definition. - :param sample_property: Sample property of type string. - :type sample_property: str + :ivar sample_property: Sample property of type string. + :vartype sample_property: str """ _attribute_map = { @@ -347,6 +406,10 @@ def __init__( sample_property: Optional[str] = None, **kwargs ): + """ + :keyword sample_property: Sample property of type string. + :paramtype sample_property: str + """ super(Result, self).__init__(**kwargs) self.sample_property = sample_property @@ -362,39 +425,39 @@ class SourceControlConfiguration(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -450,6 +513,40 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(system_data=system_data, **kwargs) self.repository_url = repository_url self.operator_namespace = operator_namespace @@ -492,6 +589,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -540,6 +639,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemData, self).__init__(**kwargs) self.created_by = None self.created_by_type = None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_source_control_configuration_client_enums.py index 3803d916bfd..f15af9df3a0 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/models/_source_control_configuration_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -36,17 +21,17 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -54,20 +39,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_operations.py index 09bd96085f7..04f675b2f5e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_source_control_configurations_operations.py index fa926900038..8eebc483790 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2020_10_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,24 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_configuration.py index 645328abb1f..d1e0dc4fffe 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_source_control_configuration_client.py index 50b673797b5..d88edd7b180 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_source_control_configuration_client.py @@ -6,79 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_03_01.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_03_01.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_03_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_configuration.py index 682d2762893..6e8d28ce1ac 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_source_control_configuration_client.py index 2db9ca6cfeb..ebbe4381c95 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/_source_control_configuration_client.py @@ -6,75 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_operations.py index 09d8376d112..ced61c24199 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_source_control_configurations_operations.py index db8449803bd..8ca4a2f361a 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/aio/operations/_source_control_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,7 +67,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. @@ -76,36 +83,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +111,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,13 +135,15 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration @@ -152,41 +154,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +191,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +209,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +256,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -303,24 +291,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +310,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +331,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +347,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +390,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/__init__.py index 95574a9920b..ec901c15835 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/__init__.py @@ -6,34 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ComplianceStatus - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Result - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Result +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ComplianceStateType, diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models.py deleted file mode 100644 index 00bd900ea10..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models.py +++ /dev/null @@ -1,495 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error definition. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ErrorDefinition - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """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. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models_py3.py index 259854d16de..fb21995b82b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_models_py3.py @@ -24,13 +24,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.MessageLevelType """ @@ -53,6 +53,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -65,11 +75,11 @@ class ErrorDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Service specific error code which serves as the substatus for the HTTP + :ivar code: Required. Service specific error code which serves as the substatus for the HTTP error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :vartype code: str + :ivar message: Required. Description of the error. + :vartype message: str """ _validation = { @@ -89,6 +99,13 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Service specific error code which serves as the substatus for the HTTP + error code. + :paramtype code: str + :keyword message: Required. Description of the error. + :paramtype message: str + """ super(ErrorDefinition, self).__init__(**kwargs) self.code = code self.message = message @@ -115,6 +132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.error = None @@ -122,10 +141,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -140,6 +159,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -176,6 +201,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -213,6 +240,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -221,10 +250,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -247,6 +276,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -256,14 +292,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -282,6 +318,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -294,8 +340,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -316,6 +362,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -324,8 +375,8 @@ def __init__( class Result(msrest.serialization.Model): """Sample result definition. - :param sample_property: Sample property of type string. - :type sample_property: str + :ivar sample_property: Sample property of type string. + :vartype sample_property: str """ _attribute_map = { @@ -338,6 +389,10 @@ def __init__( sample_property: Optional[str] = None, **kwargs ): + """ + :keyword sample_property: Sample property of type string. + :paramtype sample_property: str + """ super(Result, self).__init__(**kwargs) self.sample_property = sample_property @@ -358,35 +413,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -442,6 +498,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -485,6 +571,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -493,22 +581,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -531,6 +619,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_source_control_configuration_client_enums.py index be122639f51..68b551afcbe 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/models/_source_control_configuration_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -36,7 +21,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -45,17 +30,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -63,20 +48,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_operations.py index 4f46b393205..284e6510ab7 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_source_control_configurations_operations.py index 7808e3e5917..a36d0e745c0 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_03_01/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -66,7 +240,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. @@ -81,36 +256,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +284,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -141,13 +308,15 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration @@ -158,41 +327,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +364,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +429,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,24 +464,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +483,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -360,12 +504,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +520,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +563,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_configuration.py index 65baac1ee82..e0d799c1310 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_source_control_configuration_client.py index 9b275bd22ad..caa563f1320 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_source_control_configuration_client.py @@ -6,109 +6,107 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_configuration.py index 1f07c12f646..d457ecaa974 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_source_control_configuration_client.py index cf79cd78669..a2fbc1fdda5 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/_source_control_configuration_client.py @@ -6,105 +6,107 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py index 224059db330..c77d6b31997 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_extension_type_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -73,36 +78,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterType': self._serialize.url("cluster_type", cluster_type, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_type=cluster_type, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -111,4 +106,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py index b0eaf6af2f6..b99f307b6ad 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_extension_types_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,7 +65,8 @@ def list( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -67,37 +74,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +115,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py index bd9f2c220fc..0fd76dd062a 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extension_type_versions_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -54,8 +60,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extensions_operations.py index a09b63b3475..65591042bb2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -193,8 +187,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -378,24 +360,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,8 +379,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -426,12 +400,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -439,38 +415,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -483,12 +458,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py index f435cdfdcb5..024729f2f0f 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._location_extension_types_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,7 +58,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -60,35 +67,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +104,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operation_status_operations.py index db90f6c6660..2d99d5e6b2f 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operation_status_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +122,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,7 +154,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -162,37 +172,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -201,4 +201,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operations.py index 3c82397333f..d62dc62020b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py index 05183fe90c1..d63c27542d2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -303,24 +293,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/__init__.py index e97bdb99166..2b481eea8c9 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/__init__.py @@ -6,64 +6,35 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ClusterScopeSettings - from ._models_py3 import ComplianceStatus - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionType - from ._models_py3 import ExtensionTypeList - from ._models_py3 import ExtensionVersionList - from ._models_py3 import ExtensionVersionListVersionsItem - from ._models_py3 import ExtensionsList - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import Identity - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SupportedScopes - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ClusterScopeSettings # type: ignore - from ._models import ComplianceStatus # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionType # type: ignore - from ._models import ExtensionTypeList # type: ignore - from ._models import ExtensionVersionList # type: ignore - from ._models import ExtensionVersionListVersionsItem # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import Identity # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SupportedScopes # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeList +from ._models_py3 import ExtensionVersionList +from ._models_py3 import ExtensionVersionListVersionsItem +from ._models_py3 import ExtensionsList +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import Identity +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SupportedScopes +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ClusterTypes, diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models.py deleted file mode 100644 index 9a722f97fbb..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models.py +++ /dev/null @@ -1,1056 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """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. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ClusterScopeSettings(ProxyResource): - """Extension scope settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_multiple_instances': {'key': 'properties.allowMultipleInstances', 'type': 'bool'}, - 'default_release_namespace': {'key': 'properties.defaultReleaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterScopeSettings, self).__init__(**kwargs) - self.allow_multiple_instances = kwargs.get('allow_multiple_instances', None) - self.default_release_namespace = kwargs.get('default_release_namespace', None) - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ErrorAdditionalInfo(msrest.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: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.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.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.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 - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.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.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: Status of installation of this extension. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionStatus] - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_info': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = None - self.custom_location_settings = None - self.package_uri = None - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects 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. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class ExtensionType(msrest.serialization.Model): - """Represents an Extension Type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :ivar release_trains: Extension release train: preview or stable. - :vartype release_trains: list[str] - :ivar cluster_types: Cluster types. Possible values include: "connectedClusters", - "managedClusters". - :vartype cluster_types: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterTypes - :ivar supported_scopes: Extension scopes. - :vartype supported_scopes: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SupportedScopes - """ - - _validation = { - 'system_data': {'readonly': True}, - 'release_trains': {'readonly': True}, - 'cluster_types': {'readonly': True}, - 'supported_scopes': {'readonly': True}, - } - - _attribute_map = { - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'release_trains': {'key': 'properties.releaseTrains', 'type': '[str]'}, - 'cluster_types': {'key': 'properties.clusterTypes', 'type': 'str'}, - 'supported_scopes': {'key': 'properties.supportedScopes', 'type': 'SupportedScopes'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionType, self).__init__(**kwargs) - self.system_data = None - self.release_trains = None - self.cluster_types = None - self.supported_scopes = None - - -class ExtensionTypeList(msrest.serialization.Model): - """List Extension Types. - - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTypeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExtensionVersionList(msrest.serialization.Model): - """List versions for an Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: Versions available for this Extension Type. - :type versions: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - """ - - _validation = { - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '[ExtensionVersionListVersionsItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionList, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.next_link = kwargs.get('next_link', None) - self.system_data = None - - -class ExtensionVersionListVersionsItem(msrest.serialization.Model): - """ExtensionVersionListVersionsItem. - - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] - """ - - _attribute_map = { - 'release_train': {'key': 'releaseTrain', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) - self.release_train = kwargs.get('release_train', None) - self.versions = kwargs.get('versions', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = None - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationDisplay - :param origin: The intended executor of the operation;governs the display of the operation in - the RBAC UX and the audit logs UX. - :type origin: str - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SupportedScopes(msrest.serialization.Model): - """Extension scopes. - - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterScopeSettings - """ - - _attribute_map = { - 'default_scope': {'key': 'defaultScope', 'type': 'str'}, - 'cluster_scope_settings': {'key': 'clusterScopeSettings', 'type': 'ClusterScopeSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedScopes, self).__init__(**kwargs) - self.default_scope = kwargs.get('default_scope', None) - self.cluster_scope_settings = kwargs.get('cluster_scope_settings', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models_py3.py index 50ef8c899cd..97597606978 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -99,10 +103,10 @@ class ClusterScopeSettings(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str + :ivar allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: str """ _validation = { @@ -126,6 +130,13 @@ def __init__( default_release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ super(ClusterScopeSettings, self).__init__(**kwargs) self.allow_multiple_instances = allow_multiple_instances self.default_release_namespace = default_release_namespace @@ -140,13 +151,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.MessageLevelType """ @@ -169,6 +180,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -201,6 +222,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -245,6 +268,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -256,8 +281,8 @@ def __init__( class ErrorResponse(msrest.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.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail """ _attribute_map = { @@ -270,6 +295,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -287,38 +316,38 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: Status of installation of this extension. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionStatus] :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail @@ -373,6 +402,34 @@ def __init__( statuses: Optional[List["ExtensionStatus"]] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionStatus] + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -415,6 +472,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -423,17 +482,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -454,6 +513,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -498,6 +571,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionType, self).__init__(**kwargs) self.system_data = None self.release_trains = None @@ -508,10 +583,11 @@ def __init__( class ExtensionTypeList(msrest.serialization.Model): """List Extension Types. - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar value: The list of Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str """ _attribute_map = { @@ -526,6 +602,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of Extension Types. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionTypeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -536,11 +619,11 @@ class ExtensionVersionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: Versions available for this Extension Type. - :type versions: + :ivar versions: Versions available for this Extension Type. + :vartype versions: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData """ @@ -562,6 +645,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword versions: Versions available for this Extension Type. + :paramtype versions: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionListVersionsItem] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionVersionList, self).__init__(**kwargs) self.versions = versions self.next_link = next_link @@ -571,10 +661,10 @@ def __init__( class ExtensionVersionListVersionsItem(msrest.serialization.Model): """ExtensionVersionListVersionsItem. - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] + :ivar release_train: The release train for this Extension Type. + :vartype release_train: str + :ivar versions: Versions available for this Extension Type and release train. + :vartype versions: list[str] """ _attribute_map = { @@ -589,6 +679,12 @@ def __init__( versions: Optional[List[str]] = None, **kwargs ): + """ + :keyword release_train: The release train for this Extension Type. + :paramtype release_train: str + :keyword versions: Versions available for this Extension Type and release train. + :paramtype versions: list[str] + """ super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) self.release_train = release_train self.versions = versions @@ -597,10 +693,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -615,6 +711,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -629,9 +731,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -651,6 +753,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -683,6 +790,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -695,14 +804,14 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] :ivar error: If present, details of the operation error. :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail """ @@ -729,6 +838,16 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -742,14 +861,14 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationDisplay - :param origin: The intended executor of the operation;governs the display of the operation in + :ivar origin: The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX. - :type origin: str + :vartype origin: str :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool """ @@ -773,6 +892,16 @@ def __init__( origin: Optional[str] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationDisplay + :keyword origin: The intended executor of the operation;governs the display of the operation in + the RBAC UX and the audit logs UX. + :paramtype origin: str + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -783,14 +912,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -809,6 +938,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -821,8 +960,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -843,6 +982,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -851,10 +995,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -869,6 +1014,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -877,9 +1029,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -892,6 +1044,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -899,9 +1056,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -914,6 +1071,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -934,36 +1096,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -1019,6 +1181,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -1062,6 +1254,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1070,10 +1264,10 @@ def __init__( class SupportedScopes(msrest.serialization.Model): """Extension scopes. - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: + :ivar default_scope: Default extension scopes: cluster or namespace. + :vartype default_scope: str + :ivar cluster_scope_settings: Scope settings. + :vartype cluster_scope_settings: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterScopeSettings """ @@ -1089,6 +1283,13 @@ def __init__( cluster_scope_settings: Optional["ClusterScopeSettings"] = None, **kwargs ): + """ + :keyword default_scope: Default extension scopes: cluster or namespace. + :paramtype default_scope: str + :keyword cluster_scope_settings: Scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterScopeSettings + """ super(SupportedScopes, self).__init__(**kwargs) self.default_scope = default_scope self.cluster_scope_settings = cluster_scope_settings @@ -1097,22 +1298,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1135,6 +1336,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_source_control_configuration_client_enums.py index d25cb04abdc..bd58c28c279 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/models/_source_control_configuration_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ClusterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster types """ CONNECTED_CLUSTERS = "connectedClusters" MANAGED_CLUSTERS = "managedClusters" -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -43,7 +28,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,22 +37,22 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class Enum5(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum5(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -75,7 +60,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -83,20 +68,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the extension resource. """ @@ -107,7 +92,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" DELETING = "Deleting" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_type_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_type_operations.py index f845b5d719a..a9e523f7ed1 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_type_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_type_operations.py @@ -5,22 +5,65 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_type: Union[str, "_models.Enum5"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterType": _SERIALIZER.url("cluster_type", cluster_type, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClusterExtensionTypeOperations(object): """ClusterExtensionTypeOperations operations. @@ -44,16 +87,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_type, # type: Union[str, "_models.Enum5"] - cluster_name, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionType" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_type: Union[str, "_models.Enum5"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": """Get Extension Type details. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -78,36 +121,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterType': self._serialize.url("cluster_type", cluster_type, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_type=cluster_type, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -116,4 +149,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_types_operations.py index 2991257b530..210d4945423 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_cluster_extension_types_operations.py @@ -5,23 +5,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClusterExtensionTypesOperations(object): """ClusterExtensionTypesOperations operations. @@ -45,14 +84,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """Get Extension Types. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +103,8 @@ def list( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -72,37 +112,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,12 +153,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extension_type_versions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extension_type_versions_operations.py index bca368e1670..c978497cf58 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extension_type_versions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extension_type_versions_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + location: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionTypeVersionsOperations(object): """ExtensionTypeVersionsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionVersionList"] + location: str, + extension_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionVersionList"]: """List available versions for an Extension Type. :param location: extension location. @@ -59,8 +96,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -68,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +146,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extensions_operations.py index 580a564a7cb..36fca482e88 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_extensions_operations.py @@ -5,25 +5,203 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +227,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -110,19 +276,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +300,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +310,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +337,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -199,18 +363,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +385,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +401,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +429,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +497,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +508,17 @@ def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,24 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -416,17 +555,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -436,12 +576,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -449,38 +591,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -493,12 +634,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_location_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_location_extension_types_operations.py index 15282cd28e0..5a8c204da5e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_location_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_location_extension_types_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LocationExtensionTypesOperations(object): """LocationExtensionTypesOperations operations. @@ -45,19 +80,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """List all Extension Types. :param location: extension location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operation_status_operations.py index 46f3330b729..c1cdf65ac6d 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,15 +129,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +147,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -76,38 +162,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,28 +205,29 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -151,7 +237,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -168,37 +255,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -207,4 +284,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operations.py index 147a262ef47..6fd3ea82cea 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_source_control_configurations_operations.py index 0a71453758b..f79edc22996 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_05_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,24 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_configuration.py index abc45d20646..b83d2cdd71b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_source_control_configuration_client.py index c53deb2d4cd..537f5bba325 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_source_control_configuration_client.py @@ -6,84 +6,86 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, OperationStatusOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.OperationStatusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_configuration.py index 3f22841a050..710846e073d 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_source_control_configuration_client.py index 4b520f9c48c..96bdeb10bc7 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/_source_control_configuration_client.py @@ -6,80 +6,86 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, OperationStatusOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.OperationStatusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_extensions_operations.py index c6c3c4f9d16..46475d98ddf 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -193,8 +187,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -378,24 +360,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +379,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def _update_initial( @@ -421,47 +394,34 @@ async def _update_initial( ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -469,8 +429,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -490,7 +453,8 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -499,15 +463,20 @@ async def begin_update( :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.PatchExtension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -522,30 +491,21 @@ async def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -557,8 +517,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -576,12 +538,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -589,38 +553,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -633,12 +596,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operation_status_operations.py index 61fca2984db..0d2cb035b00 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operation_status_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +122,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,7 +154,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -162,37 +172,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -201,4 +201,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operations.py index 103c895ff59..2113e3798fe 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,8 +55,10 @@ def list( this api-version. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -58,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,12 +99,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/__init__.py index 2bcf3a10bde..01a45e76c93 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/__init__.py @@ -6,48 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionPropertiesAksAssignedIdentity - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionsList - from ._models_py3 import Identity - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import PatchExtension - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import Identity # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import PatchExtension # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionsList +from ._models_py3 import Identity +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( CreatedByType, diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models.py deleted file mode 100644 index 82ac361f3a2..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models.py +++ /dev/null @@ -1,739 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class ErrorAdditionalInfo(msrest.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: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.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.kubernetesconfiguration.v2021_09_01.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.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 - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.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.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """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. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: The provisioning state of the extension resource. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] - :param error_info: The error detail. - :type error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionPropertiesAksAssignedIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = kwargs.get('error_info', None) - self.custom_location_settings = None - self.package_uri = None - self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) - - -class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): - """Identity of the Extension resource in an AKS cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects 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. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - All required parameters must be populated in order to send to Azure. - - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :param error: The error detail. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = kwargs.get('error', None) - - -class PatchExtension(msrest.serialization.Model): - """The Extension Patch Request object. - - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchExtension, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _validation = { - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - self.origin = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models_py3.py index dfc2c01aab6..e60feb17869 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_models_py3.py @@ -40,6 +40,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -94,8 +98,8 @@ def __init__( class ErrorResponse(msrest.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.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail """ _attribute_map = { @@ -108,6 +112,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -143,6 +151,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -180,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -196,46 +208,46 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: The provisioning state of the extension resource. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] - :param error_info: The error detail. - :type error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] + :ivar error_info: The error detail. + :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail :ivar custom_location_settings: Custom Location settings properties. :vartype custom_location_settings: dict[str, str] :ivar package_uri: Uri of the Helm package. :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionPropertiesAksAssignedIdentity """ @@ -286,6 +298,39 @@ def __init__( aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] + :keyword error_info: The error detail. + :paramtype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionPropertiesAksAssignedIdentity + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -313,9 +358,9 @@ class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -335,6 +380,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -366,6 +416,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -374,17 +426,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -405,6 +457,19 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -422,9 +487,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -444,6 +509,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -476,6 +546,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -486,16 +558,16 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :param error: The error detail. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] + :ivar error: The error detail. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail """ _validation = { @@ -520,6 +592,18 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + :keyword error: The error detail. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -531,21 +615,21 @@ def __init__( class PatchExtension(msrest.serialization.Model): """The Extension Patch Request object. - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -566,6 +650,23 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ super(PatchExtension, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -579,10 +680,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -609,6 +710,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -619,14 +727,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -645,6 +753,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -657,8 +775,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -679,6 +797,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -687,10 +810,10 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace """ _attribute_map = { @@ -705,6 +828,12 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -713,9 +842,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -728,6 +857,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -735,9 +869,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -750,6 +884,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -757,22 +896,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -795,6 +934,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_source_control_configuration_client_enums.py index 19b127e8cd4..48f19c25f2c 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/models/_source_control_configuration_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,17 +20,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -53,7 +38,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the extension resource. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_extensions_operations.py index 7517bdd8cd2..4e718b52671 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_extensions_operations.py @@ -5,25 +5,253 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +277,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -110,19 +326,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +350,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +360,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +387,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -199,18 +413,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +435,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +451,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +479,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +547,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +558,17 @@ def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,24 +586,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -416,62 +605,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -479,19 +655,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Patch an existing Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -501,7 +679,8 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -510,15 +689,19 @@ def begin_update( :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.PatchExtension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -533,30 +716,21 @@ def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -568,17 +742,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -588,12 +763,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -601,38 +778,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -645,12 +821,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operation_status_operations.py index 1343bf36641..c418a705a30 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,15 +129,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +147,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -76,38 +162,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,28 +205,29 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -151,7 +237,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -168,37 +255,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -207,4 +284,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operations.py index 1cb21812c9b..e18d70e2222 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_09_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,17 +72,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports, in this api-version. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -63,30 +92,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,12 +125,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_configuration.py index bfc7dcb3271..b822e7bc318 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_source_control_configuration_client.py index 83ffa08737e..7a4739e5d02 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_source_control_configuration_client.py @@ -6,119 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.SourceControlConfigurationsOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigOperationStatusOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_configuration.py index bce1f6a3c16..b86d839a94e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_source_control_configuration_client.py index dbc71d712f5..e46bfe1b885 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/_source_control_configuration_client.py @@ -6,115 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigOperationStatusOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py index a18843f7071..0f6ebc8b36a 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_extension_type_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -73,36 +79,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -111,4 +107,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py index 3c3bf55c4ad..ddeddcf87c6 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_extension_types_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,12 +122,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py index 851eaef220c..2fb6a487db6 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extension_type_versions_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -54,8 +60,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extensions_operations.py index c791c42c624..a80a7a43909 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -193,8 +187,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -378,24 +360,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,6 +379,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def _update_initial( @@ -421,47 +394,34 @@ async def _update_initial( ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -469,8 +429,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -490,24 +453,31 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -522,30 +492,21 @@ async def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -557,8 +518,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -576,12 +539,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -589,38 +554,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -633,12 +597,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py index bc1c6c9bc76..278055cbaf8 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._flux_config_operation_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +64,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,37 +82,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -115,4 +111,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py index 73134513fb3..75827d96b95 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._flux_configurations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,7 +67,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,36 +83,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -114,8 +111,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -128,47 +127,34 @@ async def _create_or_update_initial( ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration, 'FluxConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -180,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,24 +190,31 @@ async def begin_create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -233,30 +229,21 @@ async def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -268,6 +255,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _update_initial( @@ -282,47 +270,34 @@ async def _update_initial( ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -330,8 +305,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -351,24 +329,31 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -383,30 +368,21 @@ async def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -418,6 +394,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _delete_initial( @@ -435,45 +412,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -494,7 +461,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -504,15 +472,17 @@ async def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -530,24 +500,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -559,8 +519,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -578,12 +540,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -591,38 +556,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -635,12 +599,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py index a77c4936e7b..4dfb3b692cd 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._location_extension_types_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,7 +58,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -60,35 +67,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +104,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operation_status_operations.py index 4369806defa..ca83ab69e8d 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operation_status_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -60,7 +66,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -77,37 +84,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -116,8 +113,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -135,12 +135,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -148,38 +150,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,12 +193,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operations.py index a56f63e2787..bff33128e43 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py index faf725104df..9e25d1d3796 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -303,24 +293,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/__init__.py index f69d190854a..b83d70226f0 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/__init__.py @@ -6,90 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ClusterScopeSettings - from ._models_py3 import ComplianceStatus - from ._models_py3 import DependsOnDefinition - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionPropertiesAksAssignedIdentity - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionType - from ._models_py3 import ExtensionTypeList - from ._models_py3 import ExtensionVersionList - from ._models_py3 import ExtensionVersionListVersionsItem - from ._models_py3 import ExtensionsList - from ._models_py3 import FluxConfiguration - from ._models_py3 import FluxConfigurationPatch - from ._models_py3 import FluxConfigurationsList - from ._models_py3 import GitRepositoryDefinition - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import HelmReleasePropertiesDefinition - from ._models_py3 import Identity - from ._models_py3 import KustomizationDefinition - from ._models_py3 import ObjectReferenceDefinition - from ._models_py3 import ObjectStatusConditionDefinition - from ._models_py3 import ObjectStatusDefinition - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import PatchExtension - from ._models_py3 import ProxyResource - from ._models_py3 import RepositoryRefDefinition - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SupportedScopes - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ClusterScopeSettings # type: ignore - from ._models import ComplianceStatus # type: ignore - from ._models import DependsOnDefinition # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionType # type: ignore - from ._models import ExtensionTypeList # type: ignore - from ._models import ExtensionVersionList # type: ignore - from ._models import ExtensionVersionListVersionsItem # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import FluxConfiguration # type: ignore - from ._models import FluxConfigurationPatch # type: ignore - from ._models import FluxConfigurationsList # type: ignore - from ._models import GitRepositoryDefinition # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import HelmReleasePropertiesDefinition # type: ignore - from ._models import Identity # type: ignore - from ._models import KustomizationDefinition # type: ignore - from ._models import ObjectReferenceDefinition # type: ignore - from ._models import ObjectStatusConditionDefinition # type: ignore - from ._models import ObjectStatusDefinition # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import PatchExtension # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RepositoryRefDefinition # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SupportedScopes # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ComplianceStatus +from ._models_py3 import DependsOnDefinition +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeList +from ._models_py3 import ExtensionVersionList +from ._models_py3 import ExtensionVersionListVersionsItem +from ._models_py3 import ExtensionsList +from ._models_py3 import FluxConfiguration +from ._models_py3 import FluxConfigurationPatch +from ._models_py3 import FluxConfigurationsList +from ._models_py3 import GitRepositoryDefinition +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import HelmReleasePropertiesDefinition +from ._models_py3 import Identity +from ._models_py3 import KustomizationDefinition +from ._models_py3 import ObjectReferenceDefinition +from ._models_py3 import ObjectStatusConditionDefinition +from ._models_py3 import ObjectStatusDefinition +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import RepositoryRefDefinition +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SupportedScopes +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ClusterTypes, diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models.py deleted file mode 100644 index c47ff7c1cde..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models.py +++ /dev/null @@ -1,1639 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """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. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ClusterScopeSettings(ProxyResource): - """Extension scope settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_multiple_instances': {'key': 'properties.allowMultipleInstances', 'type': 'bool'}, - 'default_release_namespace': {'key': 'properties.defaultReleaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterScopeSettings, self).__init__(**kwargs) - self.allow_multiple_instances = kwargs.get('allow_multiple_instances', None) - self.default_release_namespace = kwargs.get('default_release_namespace', None) - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class DependsOnDefinition(msrest.serialization.Model): - """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str - """ - - _attribute_map = { - 'kustomization_name': {'key': 'kustomizationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DependsOnDefinition, self).__init__(**kwargs) - self.kustomization_name = kwargs.get('kustomization_name', None) - - -class ErrorAdditionalInfo(msrest.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: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.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.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.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 - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.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.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: Status of installation of this extension. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionStatus] - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionPropertiesAksAssignedIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_info': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = None - self.custom_location_settings = None - self.package_uri = None - self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) - - -class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): - """Identity of the Extension resource in an AKS cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects 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. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class ExtensionType(msrest.serialization.Model): - """Represents an Extension Type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :ivar release_trains: Extension release train: preview or stable. - :vartype release_trains: list[str] - :ivar cluster_types: Cluster types. Possible values include: "connectedClusters", - "managedClusters". - :vartype cluster_types: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterTypes - :ivar supported_scopes: Extension scopes. - :vartype supported_scopes: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SupportedScopes - """ - - _validation = { - 'system_data': {'readonly': True}, - 'release_trains': {'readonly': True}, - 'cluster_types': {'readonly': True}, - 'supported_scopes': {'readonly': True}, - } - - _attribute_map = { - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'release_trains': {'key': 'properties.releaseTrains', 'type': '[str]'}, - 'cluster_types': {'key': 'properties.clusterTypes', 'type': 'str'}, - 'supported_scopes': {'key': 'properties.supportedScopes', 'type': 'SupportedScopes'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionType, self).__init__(**kwargs) - self.system_data = None - self.release_trains = None - self.cluster_types = None - self.supported_scopes = None - - -class ExtensionTypeList(msrest.serialization.Model): - """List Extension Types. - - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTypeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExtensionVersionList(msrest.serialization.Model): - """List versions for an Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: Versions available for this Extension Type. - :type versions: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - """ - - _validation = { - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '[ExtensionVersionListVersionsItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionList, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.next_link = kwargs.get('next_link', None) - self.system_data = None - - -class ExtensionVersionListVersionsItem(msrest.serialization.Model): - """ExtensionVersionListVersionsItem. - - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] - """ - - _attribute_map = { - 'release_train': {'key': 'releaseTrain', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) - self.release_train = kwargs.get('release_train', None) - self.versions = kwargs.get('versions', None) - - -class FluxConfiguration(ProxyResource): - """The Flux Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or - created by the managed objects provisioned by the fluxConfiguration. - :vartype statuses: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusDefinition] - :ivar repository_public_key: Public Key associated with this fluxConfiguration (either - generated within the cluster or provided by the user). - :vartype repository_public_key: str - :ivar last_source_synced_commit_id: Branch and SHA of the last source commit synced with the - cluster. - :vartype last_source_synced_commit_id: str - :ivar last_source_synced_at: Datetime the fluxConfiguration last synced its source on the - cluster. - :vartype last_source_synced_at: ~datetime.datetime - :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the - fluxConfiguration or created by the managed objects. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState - :ivar provisioning_state: Status of the creation of the fluxConfiguration. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningState - :ivar error_message: Error message returned to the user in the case of provisioning failure. - :vartype error_message: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'statuses': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'last_source_synced_commit_id': {'readonly': True}, - 'last_source_synced_at': {'readonly': True}, - 'compliance_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_message': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'namespace': {'key': 'properties.namespace', 'type': 'str'}, - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ObjectStatusDefinition]'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'last_source_synced_commit_id': {'key': 'properties.lastSourceSyncedCommitId', 'type': 'str'}, - 'last_source_synced_at': {'key': 'properties.lastSourceSyncedAt', 'type': 'iso-8601'}, - 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfiguration, self).__init__(**kwargs) - self.system_data = None - self.scope = kwargs.get('scope', "cluster") - self.namespace = kwargs.get('namespace', "default") - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', False) - self.git_repository = kwargs.get('git_repository', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.statuses = None - self.repository_public_key = None - self.last_source_synced_commit_id = None - self.last_source_synced_at = None - self.compliance_state = None - self.provisioning_state = None - self.error_message = None - - -class FluxConfigurationPatch(msrest.serialization.Model): - """The Flux Configuration Patch Request object. - - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationPatch, self).__init__(**kwargs) - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', False) - self.git_repository = kwargs.get('git_repository', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class FluxConfigurationsList(msrest.serialization.Model): - """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration objects 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. - - :ivar value: List of Flux Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FluxConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GitRepositoryDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to - access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Base64-encoded HTTPS username used to access private git repositories over - HTTPS. - :type https_user: str - :param https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git - private git repositories over HTTPS. - :type https_ca_file: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, - 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, - 'https_user': {'key': 'httpsUser', 'type': 'str'}, - 'https_ca_file': {'key': 'httpsCAFile', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepositoryDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.repository_ref = kwargs.get('repository_ref', None) - self.ssh_known_hosts = kwargs.get('ssh_known_hosts', None) - self.https_user = kwargs.get('https_user', None) - self.https_ca_file = kwargs.get('https_ca_file', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class HelmReleasePropertiesDefinition(msrest.serialization.Model): - """HelmReleasePropertiesDefinition. - - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this - HelmRelease. - :type helm_chart_ref: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long - """ - - _attribute_map = { - 'last_revision_applied': {'key': 'lastRevisionApplied', 'type': 'long'}, - 'helm_chart_ref': {'key': 'helmChartRef', 'type': 'ObjectReferenceDefinition'}, - 'failure_count': {'key': 'failureCount', 'type': 'long'}, - 'install_failure_count': {'key': 'installFailureCount', 'type': 'long'}, - 'upgrade_failure_count': {'key': 'upgradeFailureCount', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) - self.last_revision_applied = kwargs.get('last_revision_applied', None) - self.helm_chart_ref = kwargs.get('helm_chart_ref', None) - self.failure_count = kwargs.get('failure_count', None) - self.install_failure_count = kwargs.get('install_failure_count', None) - self.upgrade_failure_count = kwargs.get('upgrade_failure_count', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class KustomizationDefinition(msrest.serialization.Model): - """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This - Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the - cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the - cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this - Kustomization. - :type prune: bool - :param validation: Specify whether to validate the Kubernetes objects referenced in the - Kustomization before applying them to the cluster. Possible values include: "none", "client", - "server". Default value: "none". - :type validation: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationValidationType - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'depends_on': {'key': 'dependsOn', 'type': '[DependsOnDefinition]'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, - 'prune': {'key': 'prune', 'type': 'bool'}, - 'validation': {'key': 'validation', 'type': 'str'}, - 'force': {'key': 'force', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KustomizationDefinition, self).__init__(**kwargs) - self.path = kwargs.get('path', "") - self.depends_on = kwargs.get('depends_on', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.retry_interval_in_seconds = kwargs.get('retry_interval_in_seconds', None) - self.prune = kwargs.get('prune', False) - self.validation = kwargs.get('validation', "none") - self.force = kwargs.get('force', False) - - -class ObjectReferenceDefinition(msrest.serialization.Model): - """Object reference to a Kubernetes object on a cluster. - - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReferenceDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - - -class ObjectStatusConditionDefinition(msrest.serialization.Model): - """Status condition of Kubernetes object. - - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str - """ - - _attribute_map = { - 'last_transition_time': {'key': 'lastTransitionTime', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusConditionDefinition, self).__init__(**kwargs) - self.last_transition_time = kwargs.get('last_transition_time', None) - self.message = kwargs.get('message', None) - self.reason = kwargs.get('reason', None) - self.status = kwargs.get('status', None) - self.type = kwargs.get('type', None) - - -class ObjectStatusDefinition(msrest.serialization.Model): - """Statuses of objects deployed by the user-specified kustomizations from the git repository. - - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied - object has come into a ready state on the cluster. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the - HelmRelease kind. - :type helm_release_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmReleasePropertiesDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'applied_by': {'key': 'appliedBy', 'type': 'ObjectReferenceDefinition'}, - 'status_conditions': {'key': 'statusConditions', 'type': '[ObjectStatusConditionDefinition]'}, - 'helm_release_properties': {'key': 'helmReleaseProperties', 'type': 'HelmReleasePropertiesDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - self.kind = kwargs.get('kind', None) - self.compliance_state = kwargs.get('compliance_state', "Unknown") - self.applied_by = kwargs.get('applied_by', None) - self.status_conditions = kwargs.get('status_conditions', None) - self.helm_release_properties = kwargs.get('helm_release_properties', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = None - - -class PatchExtension(msrest.serialization.Model): - """The Extension Patch Request object. - - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchExtension, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class RepositoryRefDefinition(msrest.serialization.Model): - """The source reference for the GitRepository object. - - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to - be valid. This takes precedence over semver. - :type commit: str - """ - - _attribute_map = { - 'branch': {'key': 'branch', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'semver': {'key': 'semver', 'type': 'str'}, - 'commit': {'key': 'commit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RepositoryRefDefinition, self).__init__(**kwargs) - self.branch = kwargs.get('branch', None) - self.tag = kwargs.get('tag', None) - self.semver = kwargs.get('semver', None) - self.commit = kwargs.get('commit', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _validation = { - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - self.origin = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SupportedScopes(msrest.serialization.Model): - """Extension scopes. - - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterScopeSettings - """ - - _attribute_map = { - 'default_scope': {'key': 'defaultScope', 'type': 'str'}, - 'cluster_scope_settings': {'key': 'clusterScopeSettings', 'type': 'ClusterScopeSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedScopes, self).__init__(**kwargs) - self.default_scope = kwargs.get('default_scope', None) - self.cluster_scope_settings = kwargs.get('cluster_scope_settings', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models_py3.py index fa18f2b46c9..b7d98fd1b6d 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -99,10 +103,10 @@ class ClusterScopeSettings(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str + :ivar allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: str """ _validation = { @@ -126,6 +130,13 @@ def __init__( default_release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ super(ClusterScopeSettings, self).__init__(**kwargs) self.allow_multiple_instances = allow_multiple_instances self.default_release_namespace = default_release_namespace @@ -140,13 +151,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.MessageLevelType """ @@ -169,6 +180,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -179,8 +200,8 @@ def __init__( class DependsOnDefinition(msrest.serialization.Model): """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str + :ivar kustomization_name: Name of the kustomization to claim dependency on. + :vartype kustomization_name: str """ _attribute_map = { @@ -193,6 +214,10 @@ def __init__( kustomization_name: Optional[str] = None, **kwargs ): + """ + :keyword kustomization_name: Name of the kustomization to claim dependency on. + :paramtype kustomization_name: str + """ super(DependsOnDefinition, self).__init__(**kwargs) self.kustomization_name = kustomization_name @@ -222,6 +247,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -266,6 +293,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -277,8 +306,8 @@ def __init__( class ErrorResponse(msrest.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.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail """ _attribute_map = { @@ -291,6 +320,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -308,38 +341,38 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: Status of installation of this extension. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionStatus] :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail @@ -347,8 +380,8 @@ class Extension(ProxyResource): :vartype custom_location_settings: dict[str, str] :ivar package_uri: Uri of the Helm package. :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionPropertiesAksAssignedIdentity """ @@ -399,6 +432,37 @@ def __init__( aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionStatus] + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionPropertiesAksAssignedIdentity + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -426,9 +490,9 @@ class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -448,6 +512,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -479,6 +548,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -487,17 +558,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -518,6 +589,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -562,6 +647,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionType, self).__init__(**kwargs) self.system_data = None self.release_trains = None @@ -572,10 +659,11 @@ def __init__( class ExtensionTypeList(msrest.serialization.Model): """List Extension Types. - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar value: The list of Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str """ _attribute_map = { @@ -590,6 +678,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of Extension Types. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionTypeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -600,11 +695,11 @@ class ExtensionVersionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: Versions available for this Extension Type. - :type versions: + :ivar versions: Versions available for this Extension Type. + :vartype versions: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData """ @@ -626,6 +721,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword versions: Versions available for this Extension Type. + :paramtype versions: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionListVersionsItem] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionVersionList, self).__init__(**kwargs) self.versions = versions self.next_link = next_link @@ -635,10 +737,10 @@ def __init__( class ExtensionVersionListVersionsItem(msrest.serialization.Model): """ExtensionVersionListVersionsItem. - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] + :ivar release_train: The release train for this Extension Type. + :vartype release_train: str + :ivar versions: Versions available for this Extension Type and release train. + :vartype versions: list[str] """ _attribute_map = { @@ -653,6 +755,12 @@ def __init__( versions: Optional[List[str]] = None, **kwargs ): + """ + :keyword release_train: The release train for this Extension Type. + :paramtype release_train: str + :keyword versions: Versions available for this Extension Type and release train. + :paramtype versions: list[str] + """ super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) self.release_train = release_train self.versions = versions @@ -674,29 +782,29 @@ class FluxConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 + :ivar scope: Scope at which the operator will be installed. Possible values include: "cluster", + "namespace". Default value: "cluster". + :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType + :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :vartype namespace: str + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. :vartype statuses: @@ -770,6 +878,32 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword scope: Scope at which the operator will be installed. Possible values include: + "cluster", "namespace". Default value: "cluster". + :paramtype scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType + :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :paramtype namespace: str + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfiguration, self).__init__(**kwargs) self.system_data = None self.scope = scope @@ -791,23 +925,23 @@ def __init__( class FluxConfigurationPatch(msrest.serialization.Model): """The Flux Configuration Patch Request object. - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -828,6 +962,25 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfigurationPatch, self).__init__(**kwargs) self.source_kind = source_kind self.suspend = suspend @@ -862,6 +1015,8 @@ def __init__( self, **kwargs ): + """ + """ super(FluxConfigurationsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -870,29 +1025,29 @@ def __init__( class GitRepositoryDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Base64-encoded HTTPS username used to access private git repositories over + :vartype ssh_known_hosts: str + :ivar https_user: Base64-encoded HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git + :vartype https_user: str + :ivar https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS. - :type https_ca_file: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype https_ca_file: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -919,6 +1074,31 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Base64-encoded HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_file: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(GitRepositoryDefinition, self).__init__(**kwargs) self.url = url self.timeout_in_seconds = timeout_in_seconds @@ -933,10 +1113,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -951,6 +1131,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -959,18 +1145,18 @@ def __init__( class HelmReleasePropertiesDefinition(msrest.serialization.Model): """HelmReleasePropertiesDefinition. - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this + :ivar last_revision_applied: The revision number of the last released object change. + :vartype last_revision_applied: long + :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this HelmRelease. - :type helm_chart_ref: + :vartype helm_chart_ref: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long + :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade. + :vartype failure_count: long + :ivar install_failure_count: Number of times that the HelmRelease failed to install. + :vartype install_failure_count: long + :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :vartype upgrade_failure_count: long """ _attribute_map = { @@ -991,6 +1177,21 @@ def __init__( upgrade_failure_count: Optional[int] = None, **kwargs ): + """ + :keyword last_revision_applied: The revision number of the last released object change. + :paramtype last_revision_applied: long + :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :paramtype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition + :keyword failure_count: Total number of times that the HelmRelease failed to install or + upgrade. + :paramtype failure_count: long + :keyword install_failure_count: Number of times that the HelmRelease failed to install. + :paramtype install_failure_count: long + :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :paramtype upgrade_failure_count: long + """ super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) self.last_revision_applied = last_revision_applied self.helm_chart_ref = helm_chart_ref @@ -1008,9 +1209,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -1030,6 +1231,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1039,32 +1245,32 @@ def __init__( class KustomizationDefinition(msrest.serialization.Model): """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: + :vartype depends_on: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this Kustomization. - :type prune: bool - :param validation: Specify whether to validate the Kubernetes objects referenced in the + :vartype prune: bool + :ivar validation: Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. Possible values include: "none", "client", "server". Default value: "none". - :type validation: str or + :vartype validation: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationValidationType - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool """ _attribute_map = { @@ -1091,6 +1297,34 @@ def __init__( force: Optional[bool] = False, **kwargs ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.DependsOnDefinition] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword validation: Specify whether to validate the Kubernetes objects referenced in the + Kustomization before applying them to the cluster. Possible values include: "none", "client", + "server". Default value: "none". + :paramtype validation: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationValidationType + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ super(KustomizationDefinition, self).__init__(**kwargs) self.path = path self.depends_on = depends_on @@ -1105,10 +1339,10 @@ def __init__( class ObjectReferenceDefinition(msrest.serialization.Model): """Object reference to a Kubernetes object on a cluster. - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str + :ivar name: Name of the object. + :vartype name: str + :ivar namespace: Namespace of the object. + :vartype namespace: str """ _attribute_map = { @@ -1123,6 +1357,12 @@ def __init__( namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the object. + :paramtype name: str + :keyword namespace: Namespace of the object. + :paramtype namespace: str + """ super(ObjectReferenceDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1131,16 +1371,16 @@ def __init__( class ObjectStatusConditionDefinition(msrest.serialization.Model): """Status condition of Kubernetes object. - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str + :ivar last_transition_time: Last time this status condition has changed. + :vartype last_transition_time: ~datetime.datetime + :ivar message: A more verbose description of the object status condition. + :vartype message: str + :ivar reason: Reason for the specified status condition type status. + :vartype reason: str + :ivar status: Status of the Kubernetes object condition type. + :vartype status: str + :ivar type: Object status condition type for this object. + :vartype type: str """ _attribute_map = { @@ -1161,6 +1401,18 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword last_transition_time: Last time this status condition has changed. + :paramtype last_transition_time: ~datetime.datetime + :keyword message: A more verbose description of the object status condition. + :paramtype message: str + :keyword reason: Reason for the specified status condition type status. + :paramtype reason: str + :keyword status: Status of the Kubernetes object condition type. + :paramtype status: str + :keyword type: Object status condition type for this object. + :paramtype type: str + """ super(ObjectStatusConditionDefinition, self).__init__(**kwargs) self.last_transition_time = last_transition_time self.message = message @@ -1172,26 +1424,26 @@ def __init__( class ObjectStatusDefinition(msrest.serialization.Model): """Statuses of objects deployed by the user-specified kustomizations from the git repository. - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied + :ivar name: Name of the applied object. + :vartype name: str + :ivar namespace: Namespace of the applied object. + :vartype namespace: str + :ivar kind: Kind of the applied object. + :vartype kind: str + :ivar compliance_state: Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: "Compliant", "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or + :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: + :ivar applied_by: Object reference to the Kustomization that applied this object. + :vartype applied_by: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: + :ivar status_conditions: List of Kubernetes object status conditions present on the cluster. + :vartype status_conditions: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the + :ivar helm_release_properties: Additional properties that are provided from objects of the HelmRelease kind. - :type helm_release_properties: + :vartype helm_release_properties: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmReleasePropertiesDefinition """ @@ -1217,6 +1469,29 @@ def __init__( helm_release_properties: Optional["HelmReleasePropertiesDefinition"] = None, **kwargs ): + """ + :keyword name: Name of the applied object. + :paramtype name: str + :keyword namespace: Namespace of the applied object. + :paramtype namespace: str + :keyword kind: Kind of the applied object. + :paramtype kind: str + :keyword compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :paramtype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState + :keyword applied_by: Object reference to the Kustomization that applied this object. + :paramtype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition + :keyword status_conditions: List of Kubernetes object status conditions present on the cluster. + :paramtype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusConditionDefinition] + :keyword helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :paramtype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmReleasePropertiesDefinition + """ super(ObjectStatusDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1253,6 +1528,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1265,14 +1542,14 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] :ivar error: If present, details of the operation error. :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail """ @@ -1299,6 +1576,16 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -1310,21 +1597,21 @@ def __init__( class PatchExtension(msrest.serialization.Model): """The Extension Patch Request object. - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -1345,6 +1632,23 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ super(PatchExtension, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -1356,16 +1660,16 @@ def __init__( class RepositoryRefDefinition(msrest.serialization.Model): """The source reference for the GitRepository object. - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to + :ivar branch: The git repository branch name to checkout. + :vartype branch: str + :ivar tag: The git repository tag name to checkout. This takes precedence over branch. + :vartype tag: str + :ivar semver: The semver range used to match against git repository tags. This takes precedence + over tag. + :vartype semver: str + :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. - :type commit: str + :vartype commit: str """ _attribute_map = { @@ -1384,6 +1688,18 @@ def __init__( commit: Optional[str] = None, **kwargs ): + """ + :keyword branch: The git repository branch name to checkout. + :paramtype branch: str + :keyword tag: The git repository tag name to checkout. This takes precedence over branch. + :paramtype tag: str + :keyword semver: The semver range used to match against git repository tags. This takes + precedence over tag. + :paramtype semver: str + :keyword commit: The commit SHA to checkout. This value must be combined with the branch name + to be valid. This takes precedence over semver. + :paramtype commit: str + """ super(RepositoryRefDefinition, self).__init__(**kwargs) self.branch = branch self.tag = tag @@ -1396,10 +1712,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -1426,6 +1742,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -1436,14 +1759,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -1462,6 +1785,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1474,8 +1807,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -1496,6 +1829,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1504,10 +1842,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -1522,6 +1861,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -1530,9 +1876,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -1545,6 +1891,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -1552,9 +1903,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -1567,6 +1918,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -1587,36 +1943,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -1672,6 +2028,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -1715,6 +2101,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1723,10 +2111,10 @@ def __init__( class SupportedScopes(msrest.serialization.Model): """Extension scopes. - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: + :ivar default_scope: Default extension scopes: cluster or namespace. + :vartype default_scope: str + :ivar cluster_scope_settings: Scope settings. + :vartype cluster_scope_settings: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterScopeSettings """ @@ -1742,6 +2130,13 @@ def __init__( cluster_scope_settings: Optional["ClusterScopeSettings"] = None, **kwargs ): + """ + :keyword default_scope: Default extension scopes: cluster or namespace. + :paramtype default_scope: str + :keyword cluster_scope_settings: Scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterScopeSettings + """ super(SupportedScopes, self).__init__(**kwargs) self.default_scope = default_scope self.cluster_scope_settings = cluster_scope_settings @@ -1750,22 +2145,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1788,6 +2183,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_source_control_configuration_client_enums.py index 7b724fe947b..544b13b91c2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/models/_source_control_configuration_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ClusterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster types """ CONNECTED_CLUSTERS = "connectedClusters" MANAGED_CLUSTERS = "managedClusters" -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -43,7 +28,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,17 +37,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FluxComplianceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compliance state of the cluster object. """ @@ -72,7 +57,7 @@ class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" UNKNOWN = "Unknown" -class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KustomizationValidationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. """ @@ -81,7 +66,7 @@ class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, CLIENT = "client" SERVER = "server" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -89,7 +74,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -97,20 +82,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource. """ @@ -121,7 +106,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" DELETING = "Deleting" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ @@ -131,14 +116,14 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" FAILED = "Failed" -class ScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the configuration will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class SourceKindType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceKindType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Source Kind to pull the configuration data from. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_type_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_type_operations.py index 116d991666f..3521f8a7573 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_type_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_type_operations.py @@ -5,22 +5,65 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClusterExtensionTypeOperations(object): """ClusterExtensionTypeOperations operations. @@ -44,16 +87,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionType" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": """Get Extension Type details. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,7 +106,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -78,36 +122,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -116,4 +150,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_types_operations.py index 9a59fe9f602..7d7e58989f9 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_cluster_extension_types_operations.py @@ -5,23 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClusterExtensionTypesOperations(object): """ClusterExtensionTypesOperations operations. @@ -45,15 +86,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """Get Extension Types. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +104,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -76,38 +119,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,12 +162,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extension_type_versions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extension_type_versions_operations.py index a9db32fce8b..b9e4fd842ee 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extension_type_versions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extension_type_versions_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + location: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionTypeVersionsOperations(object): """ExtensionTypeVersionsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionVersionList"] + location: str, + extension_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionVersionList"]: """List available versions for an Extension Type. :param location: extension location. @@ -59,8 +96,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -68,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +146,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extensions_operations.py index b9a4aa6a917..0531c000385 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_extensions_operations.py @@ -5,25 +5,253 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +277,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -110,19 +326,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +350,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +360,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +387,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -199,18 +413,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +435,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +451,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +479,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +547,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +558,17 @@ def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,24 +586,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -416,62 +605,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -479,19 +655,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Patch an existing Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -501,24 +679,30 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -533,30 +717,21 @@ def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -568,17 +743,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -588,12 +764,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -601,38 +779,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -645,12 +822,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py index 4bd346a003f..dea63e7dac3 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py @@ -5,22 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FluxConfigOperationStatusOperations(object): """FluxConfigOperationStatusOperations operations. @@ -44,17 +89,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +109,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,37 +127,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -120,4 +156,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_configurations_operations.py index 0b8e72b4573..c3d3cf613ba 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_flux_configurations_operations.py @@ -5,25 +5,253 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FluxConfigurationsOperations(object): """FluxConfigurationsOperations operations. @@ -47,16 +275,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> "_models.FluxConfiguration": """Gets details of the Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +294,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,36 +310,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -119,62 +338,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(flux_configuration, 'FluxConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -186,19 +393,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Create a new Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -208,24 +417,31 @@ def begin_create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -240,30 +456,21 @@ def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -275,62 +482,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -338,19 +532,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Update an existing Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,24 +556,31 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -392,30 +595,21 @@ def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -427,74 +621,63 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the source repo. @@ -505,7 +688,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -515,15 +699,17 @@ def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -541,24 +727,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -570,17 +746,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FluxConfigurationsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.FluxConfigurationsList"]: """List all Flux Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -590,12 +767,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -603,38 +783,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -647,12 +826,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_location_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_location_extension_types_operations.py index 7e4e5eb165e..6e8be79c061 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_location_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_location_extension_types_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LocationExtensionTypesOperations(object): """LocationExtensionTypesOperations operations. @@ -45,19 +80,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """List all Extension Types. :param location: extension location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operation_status_operations.py index 9cd277b30f3..99b73b72038 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,17 +129,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +149,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -82,37 +167,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -121,17 +196,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,12 +218,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -154,38 +233,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -198,12 +276,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operations.py index 35394f50809..c047a8d76ca 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_source_control_configurations_operations.py index 3233f416ca0..4fe01af8220 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2021_11_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,24 +466,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/__init__.py index f13062376d7..e9096303633 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_configuration.py index b75a1084ebc..79ca1e2de57 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_source_control_configuration_client.py index 4fd5d4958ff..7a271a30691 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_source_control_configuration_client.py @@ -6,119 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.LocationExtensionTypesOperations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.OperationStatusOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigOperationStatusOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/__init__.py index ba52c91a7ba..5f583276b4e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_configuration.py index fc051b59148..c39cb2de0a3 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_configuration.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_source_control_configuration_client.py index 502030b5568..d2a714a6378 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_source_control_configuration_client.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/_source_control_configuration_client.py @@ -6,115 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.LocationExtensionTypesOperations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.OperationStatusOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigOperationStatusOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py index 5ad38f9c1db..ef07f9a9e3c 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_extension_type_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,11 +44,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_type_name: str, **kwargs: Any @@ -55,10 +60,12 @@ async def get( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -73,36 +80,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -111,4 +108,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py index 271b9752354..4cb9726a017 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_extension_types_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.ExtensionTypeList"]: @@ -55,15 +61,18 @@ def list( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -71,38 +80,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,12 +123,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py index 67d9ef02043..8c3770819b1 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extension_type_versions_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -54,8 +60,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extensions_operations.py index abfa18fde51..12f782fcec9 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,8 +51,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def _create_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, extension: "_models.Extension", @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -105,13 +99,16 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, extension: "_models.Extension", @@ -123,10 +120,12 @@ async def begin_create( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +134,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +162,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -193,13 +188,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, **kwargs: Any @@ -210,10 +207,12 @@ async def get( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +227,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,13 +255,15 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, force_delete: Optional[bool] = None, @@ -283,50 +274,40 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, force_delete: Optional[bool] = None, @@ -339,10 +320,12 @@ async def begin_delete( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +335,17 @@ async def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -378,24 +363,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -407,13 +382,14 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def _update_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, patch_extension: "_models.PatchExtension", @@ -424,42 +400,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(patch_extension, 'PatchExtension') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -467,13 +432,16 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, patch_extension: "_models.PatchExtension", @@ -485,27 +453,35 @@ async def begin_update( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -520,30 +496,21 @@ async def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -555,13 +522,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.ExtensionsList"]: @@ -571,15 +540,18 @@ def list( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -587,38 +559,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -631,12 +602,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py index 22b61526ac8..e1cd85a2f49 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._flux_config_operation_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,11 +44,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, operation_id: str, @@ -56,10 +61,12 @@ async def get( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,37 +83,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -115,4 +112,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py index 175b59e0bed..92088a6cd74 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._flux_configurations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, **kwargs: Any @@ -58,10 +64,12 @@ async def get( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -114,13 +112,15 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, flux_configuration: "_models.FluxConfiguration", @@ -131,42 +131,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration, 'FluxConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -178,13 +167,16 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, flux_configuration: "_models.FluxConfiguration", @@ -196,27 +188,35 @@ async def begin_create_or_update( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -231,30 +231,21 @@ async def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -266,13 +257,14 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _update_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, flux_configuration_patch: "_models.FluxConfigurationPatch", @@ -283,42 +275,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -326,13 +307,16 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, flux_configuration_patch: "_models.FluxConfigurationPatch", @@ -344,27 +328,35 @@ async def begin_update( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,30 +371,21 @@ async def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -414,13 +397,14 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, force_delete: Optional[bool] = None, @@ -431,50 +415,40 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, flux_configuration_name: str, force_delete: Optional[bool] = None, @@ -487,10 +461,12 @@ async def begin_delete( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -500,15 +476,17 @@ async def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -526,24 +504,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -555,13 +523,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.FluxConfigurationsList"]: @@ -571,15 +541,19 @@ def list( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -587,38 +561,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -631,12 +604,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py index 6962894f914..9b9f60426e2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._location_extension_types_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,7 +58,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -60,35 +67,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +104,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operation_status_operations.py index 3f20c7ee86b..24011064962 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operation_status_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, extension_name: str, operation_id: str, @@ -57,10 +63,12 @@ async def get( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -77,37 +85,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -116,13 +114,16 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.OperationStatusList"]: @@ -132,15 +133,18 @@ def list( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -148,38 +152,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,12 +195,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operations.py index 6881dde9984..8fce071678e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py index b1f67c247e3..4c903fd96e6 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async 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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, source_control_configuration_name: str, **kwargs: Any @@ -58,17 +64,20 @@ async def get( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +85,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,13 +113,16 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, source_control_configuration_name: str, source_control_configuration: "_models.SourceControlConfiguration", @@ -132,19 +134,23 @@ async def create_or_update( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +158,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,13 +195,15 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, source_control_configuration_name: str, **kwargs: Any @@ -215,48 +213,39 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, source_control_configuration_name: str, **kwargs: Any @@ -268,25 +257,29 @@ async def begin_delete( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -303,24 +296,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,13 +315,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, - cluster_rp: Union[str, "_models.Enum0"], - cluster_resource_name: Union[str, "_models.Enum1"], + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.SourceControlConfigurationList"]: @@ -348,15 +333,19 @@ def list( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +353,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +396,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/__init__.py index bd6cd25837f..32ad88439d1 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/__init__.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/__init__.py @@ -6,105 +6,59 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import BucketDefinition - from ._models_py3 import BucketPatchDefinition - from ._models_py3 import ClusterScopeSettings - from ._models_py3 import ComplianceStatus - from ._models_py3 import DependsOnDefinition - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionPropertiesAksAssignedIdentity - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionType - from ._models_py3 import ExtensionTypeList - from ._models_py3 import ExtensionVersionList - from ._models_py3 import ExtensionVersionListVersionsItem - from ._models_py3 import ExtensionsList - from ._models_py3 import FluxConfiguration - from ._models_py3 import FluxConfigurationPatch - from ._models_py3 import FluxConfigurationsList - from ._models_py3 import GitRepositoryDefinition - from ._models_py3 import GitRepositoryPatchDefinition - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import HelmReleasePropertiesDefinition - from ._models_py3 import Identity - from ._models_py3 import KustomizationDefinition - from ._models_py3 import KustomizationPatchDefinition - from ._models_py3 import ObjectReferenceDefinition - from ._models_py3 import ObjectStatusConditionDefinition - from ._models_py3 import ObjectStatusDefinition - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import PatchExtension - from ._models_py3 import ProxyResource - from ._models_py3 import RepositoryRefDefinition - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SupportedScopes - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import BucketDefinition # type: ignore - from ._models import BucketPatchDefinition # type: ignore - from ._models import ClusterScopeSettings # type: ignore - from ._models import ComplianceStatus # type: ignore - from ._models import DependsOnDefinition # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionType # type: ignore - from ._models import ExtensionTypeList # type: ignore - from ._models import ExtensionVersionList # type: ignore - from ._models import ExtensionVersionListVersionsItem # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import FluxConfiguration # type: ignore - from ._models import FluxConfigurationPatch # type: ignore - from ._models import FluxConfigurationsList # type: ignore - from ._models import GitRepositoryDefinition # type: ignore - from ._models import GitRepositoryPatchDefinition # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import HelmReleasePropertiesDefinition # type: ignore - from ._models import Identity # type: ignore - from ._models import KustomizationDefinition # type: ignore - from ._models import KustomizationPatchDefinition # type: ignore - from ._models import ObjectReferenceDefinition # type: ignore - from ._models import ObjectStatusConditionDefinition # type: ignore - from ._models import ObjectStatusDefinition # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import PatchExtension # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RepositoryRefDefinition # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SupportedScopes # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import BucketDefinition +from ._models_py3 import BucketPatchDefinition +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ComplianceStatus +from ._models_py3 import DependsOnDefinition +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeList +from ._models_py3 import ExtensionVersionList +from ._models_py3 import ExtensionVersionListVersionsItem +from ._models_py3 import ExtensionsList +from ._models_py3 import FluxConfiguration +from ._models_py3 import FluxConfigurationPatch +from ._models_py3 import FluxConfigurationsList +from ._models_py3 import GitRepositoryDefinition +from ._models_py3 import GitRepositoryPatchDefinition +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import HelmReleasePropertiesDefinition +from ._models_py3 import Identity +from ._models_py3 import KustomizationDefinition +from ._models_py3 import KustomizationPatchDefinition +from ._models_py3 import ObjectReferenceDefinition +from ._models_py3 import ObjectStatusConditionDefinition +from ._models_py3 import ObjectStatusDefinition +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import RepositoryRefDefinition +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SupportedScopes +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ClusterTypes, ComplianceStateType, CreatedByType, - Enum0, - Enum1, + ExtensionsClusterResourceName, + ExtensionsClusterRp, FluxComplianceState, KustomizationValidationType, LevelType, @@ -166,8 +120,8 @@ 'ClusterTypes', 'ComplianceStateType', 'CreatedByType', - 'Enum0', - 'Enum1', + 'ExtensionsClusterResourceName', + 'ExtensionsClusterRp', 'FluxComplianceState', 'KustomizationValidationType', 'LevelType', diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models.py deleted file mode 100644 index cf53332d58c..00000000000 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models.py +++ /dev/null @@ -1,1836 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class BucketDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 - bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'bucket_name': {'key': 'bucketName', 'type': 'str'}, - 'insecure': {'key': 'insecure', 'type': 'bool'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BucketDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.bucket_name = kwargs.get('bucket_name', None) - self.insecure = kwargs.get('insecure', True) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.access_key = kwargs.get('access_key', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class BucketPatchDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 - bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'bucket_name': {'key': 'bucketName', 'type': 'str'}, - 'insecure': {'key': 'insecure', 'type': 'bool'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BucketPatchDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.bucket_name = kwargs.get('bucket_name', None) - self.insecure = kwargs.get('insecure', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', None) - self.access_key = kwargs.get('access_key', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """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. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ClusterScopeSettings(ProxyResource): - """Extension scope settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_multiple_instances': {'key': 'properties.allowMultipleInstances', 'type': 'bool'}, - 'default_release_namespace': {'key': 'properties.defaultReleaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterScopeSettings, self).__init__(**kwargs) - self.allow_multiple_instances = kwargs.get('allow_multiple_instances', None) - self.default_release_namespace = kwargs.get('default_release_namespace', None) - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class DependsOnDefinition(msrest.serialization.Model): - """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str - """ - - _attribute_map = { - 'kustomization_name': {'key': 'kustomizationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DependsOnDefinition, self).__init__(**kwargs) - self.kustomization_name = kwargs.get('kustomization_name', None) - - -class ErrorAdditionalInfo(msrest.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: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.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.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.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 - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.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.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: Status of installation of this extension. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionStatus] - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionPropertiesAksAssignedIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_info': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = None - self.custom_location_settings = None - self.package_uri = None - self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) - - -class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): - """Identity of the Extension resource in an AKS cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects 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. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class ExtensionType(msrest.serialization.Model): - """Represents an Extension Type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :ivar release_trains: Extension release train: preview or stable. - :vartype release_trains: list[str] - :ivar cluster_types: Cluster types. Possible values include: "connectedClusters", - "managedClusters". - :vartype cluster_types: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterTypes - :ivar supported_scopes: Extension scopes. - :vartype supported_scopes: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SupportedScopes - """ - - _validation = { - 'system_data': {'readonly': True}, - 'release_trains': {'readonly': True}, - 'cluster_types': {'readonly': True}, - 'supported_scopes': {'readonly': True}, - } - - _attribute_map = { - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'release_trains': {'key': 'properties.releaseTrains', 'type': '[str]'}, - 'cluster_types': {'key': 'properties.clusterTypes', 'type': 'str'}, - 'supported_scopes': {'key': 'properties.supportedScopes', 'type': 'SupportedScopes'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionType, self).__init__(**kwargs) - self.system_data = None - self.release_trains = None - self.cluster_types = None - self.supported_scopes = None - - -class ExtensionTypeList(msrest.serialization.Model): - """List Extension Types. - - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTypeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExtensionVersionList(msrest.serialization.Model): - """List versions for an Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: Versions available for this Extension Type. - :type versions: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - """ - - _validation = { - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '[ExtensionVersionListVersionsItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionList, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.next_link = kwargs.get('next_link', None) - self.system_data = None - - -class ExtensionVersionListVersionsItem(msrest.serialization.Model): - """ExtensionVersionListVersionsItem. - - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] - """ - - _attribute_map = { - 'release_train': {'key': 'releaseTrain', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) - self.release_train = kwargs.get('release_train', None) - self.versions = kwargs.get('versions', None) - - -class FluxConfiguration(ProxyResource): - """The Flux Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository", "Bucket". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or - created by the managed objects provisioned by the fluxConfiguration. - :vartype statuses: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusDefinition] - :ivar repository_public_key: Public Key associated with this fluxConfiguration (either - generated within the cluster or provided by the user). - :vartype repository_public_key: str - :ivar last_source_updated_commit_id: Branch and SHA of the last source commit synced with the - cluster. - :vartype last_source_updated_commit_id: str - :ivar last_source_updated_at: Datetime the fluxConfiguration last synced its source on the - cluster. - :vartype last_source_updated_at: ~datetime.datetime - :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the - fluxConfiguration or created by the managed objects. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState - :ivar provisioning_state: Status of the creation of the fluxConfiguration. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningState - :ivar error_message: Error message returned to the user in the case of provisioning failure. - :vartype error_message: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'statuses': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'last_source_updated_commit_id': {'readonly': True}, - 'last_source_updated_at': {'readonly': True}, - 'compliance_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_message': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'namespace': {'key': 'properties.namespace', 'type': 'str'}, - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, - 'bucket': {'key': 'properties.bucket', 'type': 'BucketDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ObjectStatusDefinition]'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'last_source_updated_commit_id': {'key': 'properties.lastSourceUpdatedCommitId', 'type': 'str'}, - 'last_source_updated_at': {'key': 'properties.lastSourceUpdatedAt', 'type': 'iso-8601'}, - 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfiguration, self).__init__(**kwargs) - self.system_data = None - self.scope = kwargs.get('scope', "cluster") - self.namespace = kwargs.get('namespace', "default") - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', False) - self.git_repository = kwargs.get('git_repository', None) - self.bucket = kwargs.get('bucket', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.statuses = None - self.repository_public_key = None - self.last_source_updated_commit_id = None - self.last_source_updated_at = None - self.compliance_state = None - self.provisioning_state = None - self.error_message = None - - -class FluxConfigurationPatch(msrest.serialization.Model): - """The Flux Configuration Patch Request object. - - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository", "Bucket". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryPatchDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationPatchDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryPatchDefinition'}, - 'bucket': {'key': 'properties.bucket', 'type': 'BucketDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationPatchDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationPatch, self).__init__(**kwargs) - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', None) - self.git_repository = kwargs.get('git_repository', None) - self.bucket = kwargs.get('bucket', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class FluxConfigurationsList(msrest.serialization.Model): - """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration objects 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. - - :ivar value: List of Flux Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FluxConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GitRepositoryDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to - access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git - private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, - 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, - 'https_user': {'key': 'httpsUser', 'type': 'str'}, - 'https_ca_cert': {'key': 'httpsCACert', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepositoryDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.repository_ref = kwargs.get('repository_ref', None) - self.ssh_known_hosts = kwargs.get('ssh_known_hosts', None) - self.https_user = kwargs.get('https_user', None) - self.https_ca_cert = kwargs.get('https_ca_cert', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class GitRepositoryPatchDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to - access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git - private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, - 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, - 'https_user': {'key': 'httpsUser', 'type': 'str'}, - 'https_ca_cert': {'key': 'httpsCACert', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepositoryPatchDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', None) - self.repository_ref = kwargs.get('repository_ref', None) - self.ssh_known_hosts = kwargs.get('ssh_known_hosts', None) - self.https_user = kwargs.get('https_user', None) - self.https_ca_cert = kwargs.get('https_ca_cert', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class HelmReleasePropertiesDefinition(msrest.serialization.Model): - """HelmReleasePropertiesDefinition. - - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this - HelmRelease. - :type helm_chart_ref: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long - """ - - _attribute_map = { - 'last_revision_applied': {'key': 'lastRevisionApplied', 'type': 'long'}, - 'helm_chart_ref': {'key': 'helmChartRef', 'type': 'ObjectReferenceDefinition'}, - 'failure_count': {'key': 'failureCount', 'type': 'long'}, - 'install_failure_count': {'key': 'installFailureCount', 'type': 'long'}, - 'upgrade_failure_count': {'key': 'upgradeFailureCount', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) - self.last_revision_applied = kwargs.get('last_revision_applied', None) - self.helm_chart_ref = kwargs.get('helm_chart_ref', None) - self.failure_count = kwargs.get('failure_count', None) - self.install_failure_count = kwargs.get('install_failure_count', None) - self.upgrade_failure_count = kwargs.get('upgrade_failure_count', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class KustomizationDefinition(msrest.serialization.Model): - """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This - Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the - cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the - cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this - Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'depends_on': {'key': 'dependsOn', 'type': '[DependsOnDefinition]'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, - 'prune': {'key': 'prune', 'type': 'bool'}, - 'force': {'key': 'force', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KustomizationDefinition, self).__init__(**kwargs) - self.path = kwargs.get('path', "") - self.depends_on = kwargs.get('depends_on', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.retry_interval_in_seconds = kwargs.get('retry_interval_in_seconds', None) - self.prune = kwargs.get('prune', False) - self.force = kwargs.get('force', False) - - -class KustomizationPatchDefinition(msrest.serialization.Model): - """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This - Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the - cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the - cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this - Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'depends_on': {'key': 'dependsOn', 'type': '[DependsOnDefinition]'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, - 'prune': {'key': 'prune', 'type': 'bool'}, - 'force': {'key': 'force', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KustomizationPatchDefinition, self).__init__(**kwargs) - self.path = kwargs.get('path', None) - self.depends_on = kwargs.get('depends_on', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', None) - self.retry_interval_in_seconds = kwargs.get('retry_interval_in_seconds', None) - self.prune = kwargs.get('prune', None) - self.force = kwargs.get('force', None) - - -class ObjectReferenceDefinition(msrest.serialization.Model): - """Object reference to a Kubernetes object on a cluster. - - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReferenceDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - - -class ObjectStatusConditionDefinition(msrest.serialization.Model): - """Status condition of Kubernetes object. - - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str - """ - - _attribute_map = { - 'last_transition_time': {'key': 'lastTransitionTime', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusConditionDefinition, self).__init__(**kwargs) - self.last_transition_time = kwargs.get('last_transition_time', None) - self.message = kwargs.get('message', None) - self.reason = kwargs.get('reason', None) - self.status = kwargs.get('status', None) - self.type = kwargs.get('type', None) - - -class ObjectStatusDefinition(msrest.serialization.Model): - """Statuses of objects deployed by the user-specified kustomizations from the git repository. - - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied - object has come into a ready state on the cluster. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the - HelmRelease kind. - :type helm_release_properties: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmReleasePropertiesDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'applied_by': {'key': 'appliedBy', 'type': 'ObjectReferenceDefinition'}, - 'status_conditions': {'key': 'statusConditions', 'type': '[ObjectStatusConditionDefinition]'}, - 'helm_release_properties': {'key': 'helmReleaseProperties', 'type': 'HelmReleasePropertiesDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - self.kind = kwargs.get('kind', None) - self.compliance_state = kwargs.get('compliance_state', "Unknown") - self.applied_by = kwargs.get('applied_by', None) - self.status_conditions = kwargs.get('status_conditions', None) - self.helm_release_properties = kwargs.get('helm_release_properties', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = None - - -class PatchExtension(msrest.serialization.Model): - """The Extension Patch Request object. - - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchExtension, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class RepositoryRefDefinition(msrest.serialization.Model): - """The source reference for the GitRepository object. - - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to - be valid. This takes precedence over semver. - :type commit: str - """ - - _attribute_map = { - 'branch': {'key': 'branch', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'semver': {'key': 'semver', 'type': 'str'}, - 'commit': {'key': 'commit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RepositoryRefDefinition, self).__init__(**kwargs) - self.branch = kwargs.get('branch', None) - self.tag = kwargs.get('tag', None) - self.semver = kwargs.get('semver', None) - self.commit = kwargs.get('commit', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _validation = { - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - self.origin = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SupportedScopes(msrest.serialization.Model): - """Extension scopes. - - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterScopeSettings - """ - - _attribute_map = { - 'default_scope': {'key': 'defaultScope', 'type': 'str'}, - 'cluster_scope_settings': {'key': 'clusterScopeSettings', 'type': 'ClusterScopeSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedScopes, self).__init__(**kwargs) - self.default_scope = kwargs.get('default_scope', None) - self.cluster_scope_settings = kwargs.get('cluster_scope_settings', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models_py3.py index 23eef7e57d6..97d3533d40d 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models_py3.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_models_py3.py @@ -18,24 +18,24 @@ class BucketDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype sync_interval_in_seconds: long + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -60,6 +60,26 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(BucketDefinition, self).__init__(**kwargs) self.url = url self.bucket_name = bucket_name @@ -73,24 +93,24 @@ def __init__( class BucketPatchDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype sync_interval_in_seconds: long + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -115,6 +135,26 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(BucketPatchDefinition, self).__init__(**kwargs) self.url = url self.bucket_name = bucket_name @@ -156,6 +196,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -193,6 +235,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -209,10 +253,10 @@ class ClusterScopeSettings(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str + :ivar allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: str """ _validation = { @@ -236,6 +280,13 @@ def __init__( default_release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ super(ClusterScopeSettings, self).__init__(**kwargs) self.allow_multiple_instances = allow_multiple_instances self.default_release_namespace = default_release_namespace @@ -250,13 +301,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.MessageLevelType """ @@ -279,6 +330,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -289,8 +350,8 @@ def __init__( class DependsOnDefinition(msrest.serialization.Model): """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str + :ivar kustomization_name: Name of the kustomization to claim dependency on. + :vartype kustomization_name: str """ _attribute_map = { @@ -303,6 +364,10 @@ def __init__( kustomization_name: Optional[str] = None, **kwargs ): + """ + :keyword kustomization_name: Name of the kustomization to claim dependency on. + :paramtype kustomization_name: str + """ super(DependsOnDefinition, self).__init__(**kwargs) self.kustomization_name = kustomization_name @@ -332,6 +397,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -376,6 +443,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -387,8 +456,8 @@ def __init__( class ErrorResponse(msrest.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.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail """ _attribute_map = { @@ -401,6 +470,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -418,38 +491,38 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: Status of installation of this extension. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionStatus] :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail @@ -457,8 +530,8 @@ class Extension(ProxyResource): :vartype custom_location_settings: dict[str, str] :ivar package_uri: Uri of the Helm package. :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionPropertiesAksAssignedIdentity """ @@ -509,6 +582,37 @@ def __init__( aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionStatus] + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionPropertiesAksAssignedIdentity + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -536,9 +640,9 @@ class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -558,6 +662,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -589,6 +698,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -597,17 +708,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -628,6 +739,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -672,6 +797,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionType, self).__init__(**kwargs) self.system_data = None self.release_trains = None @@ -682,10 +809,11 @@ def __init__( class ExtensionTypeList(msrest.serialization.Model): """List Extension Types. - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar value: The list of Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str """ _attribute_map = { @@ -700,6 +828,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of Extension Types. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionTypeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -710,11 +845,11 @@ class ExtensionVersionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: Versions available for this Extension Type. - :type versions: + :ivar versions: Versions available for this Extension Type. + :vartype versions: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData """ @@ -736,6 +871,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword versions: Versions available for this Extension Type. + :paramtype versions: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionListVersionsItem] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionVersionList, self).__init__(**kwargs) self.versions = versions self.next_link = next_link @@ -745,10 +887,10 @@ def __init__( class ExtensionVersionListVersionsItem(msrest.serialization.Model): """ExtensionVersionListVersionsItem. - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] + :ivar release_train: The release train for this Extension Type. + :vartype release_train: str + :ivar versions: Versions available for this Extension Type and release train. + :vartype versions: list[str] """ _attribute_map = { @@ -763,6 +905,12 @@ def __init__( versions: Optional[List[str]] = None, **kwargs ): + """ + :keyword release_train: The release train for this Extension Type. + :paramtype release_train: str + :keyword versions: Versions available for this Extension Type and release train. + :paramtype versions: list[str] + """ super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) self.release_train = release_train self.versions = versions @@ -784,31 +932,32 @@ class FluxConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 + :ivar scope: Scope at which the operator will be installed. Possible values include: "cluster", + "namespace". Default value: "cluster". + :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType + :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :vartype namespace: str + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository", "Bucket". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. :vartype statuses: @@ -884,6 +1033,35 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword scope: Scope at which the operator will be installed. Possible values include: + "cluster", "namespace". Default value: "cluster". + :paramtype scope: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType + :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :paramtype namespace: str + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfiguration, self).__init__(**kwargs) self.system_data = None self.scope = scope @@ -906,25 +1084,26 @@ def __init__( class FluxConfigurationPatch(msrest.serialization.Model): """The Flux Configuration Patch Request object. - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository", "Bucket". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryPatchDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationPatchDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -947,6 +1126,28 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryPatchDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationPatchDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfigurationPatch, self).__init__(**kwargs) self.source_kind = source_kind self.suspend = suspend @@ -982,6 +1183,8 @@ def __init__( self, **kwargs ): + """ + """ super(FluxConfigurationsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -990,28 +1193,28 @@ def __init__( class GitRepositoryDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -1038,6 +1241,31 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(GitRepositoryDefinition, self).__init__(**kwargs) self.url = url self.timeout_in_seconds = timeout_in_seconds @@ -1052,28 +1280,28 @@ def __init__( class GitRepositoryPatchDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -1100,6 +1328,31 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(GitRepositoryPatchDefinition, self).__init__(**kwargs) self.url = url self.timeout_in_seconds = timeout_in_seconds @@ -1114,10 +1367,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -1132,6 +1385,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -1140,18 +1399,18 @@ def __init__( class HelmReleasePropertiesDefinition(msrest.serialization.Model): """HelmReleasePropertiesDefinition. - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this + :ivar last_revision_applied: The revision number of the last released object change. + :vartype last_revision_applied: long + :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this HelmRelease. - :type helm_chart_ref: + :vartype helm_chart_ref: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long + :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade. + :vartype failure_count: long + :ivar install_failure_count: Number of times that the HelmRelease failed to install. + :vartype install_failure_count: long + :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :vartype upgrade_failure_count: long """ _attribute_map = { @@ -1172,6 +1431,21 @@ def __init__( upgrade_failure_count: Optional[int] = None, **kwargs ): + """ + :keyword last_revision_applied: The revision number of the last released object change. + :paramtype last_revision_applied: long + :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :paramtype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition + :keyword failure_count: Total number of times that the HelmRelease failed to install or + upgrade. + :paramtype failure_count: long + :keyword install_failure_count: Number of times that the HelmRelease failed to install. + :paramtype install_failure_count: long + :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :paramtype upgrade_failure_count: long + """ super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) self.last_revision_applied = last_revision_applied self.helm_chart_ref = helm_chart_ref @@ -1189,9 +1463,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -1211,6 +1485,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1220,27 +1499,27 @@ def __init__( class KustomizationDefinition(msrest.serialization.Model): """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: + :vartype depends_on: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool """ _attribute_map = { @@ -1265,6 +1544,29 @@ def __init__( force: Optional[bool] = False, **kwargs ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ super(KustomizationDefinition, self).__init__(**kwargs) self.path = path self.depends_on = depends_on @@ -1278,27 +1580,27 @@ def __init__( class KustomizationPatchDefinition(msrest.serialization.Model): """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: + :vartype depends_on: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool """ _attribute_map = { @@ -1323,6 +1625,29 @@ def __init__( force: Optional[bool] = None, **kwargs ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ super(KustomizationPatchDefinition, self).__init__(**kwargs) self.path = path self.depends_on = depends_on @@ -1336,10 +1661,10 @@ def __init__( class ObjectReferenceDefinition(msrest.serialization.Model): """Object reference to a Kubernetes object on a cluster. - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str + :ivar name: Name of the object. + :vartype name: str + :ivar namespace: Namespace of the object. + :vartype namespace: str """ _attribute_map = { @@ -1354,6 +1679,12 @@ def __init__( namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the object. + :paramtype name: str + :keyword namespace: Namespace of the object. + :paramtype namespace: str + """ super(ObjectReferenceDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1362,16 +1693,16 @@ def __init__( class ObjectStatusConditionDefinition(msrest.serialization.Model): """Status condition of Kubernetes object. - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str + :ivar last_transition_time: Last time this status condition has changed. + :vartype last_transition_time: ~datetime.datetime + :ivar message: A more verbose description of the object status condition. + :vartype message: str + :ivar reason: Reason for the specified status condition type status. + :vartype reason: str + :ivar status: Status of the Kubernetes object condition type. + :vartype status: str + :ivar type: Object status condition type for this object. + :vartype type: str """ _attribute_map = { @@ -1392,6 +1723,18 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword last_transition_time: Last time this status condition has changed. + :paramtype last_transition_time: ~datetime.datetime + :keyword message: A more verbose description of the object status condition. + :paramtype message: str + :keyword reason: Reason for the specified status condition type status. + :paramtype reason: str + :keyword status: Status of the Kubernetes object condition type. + :paramtype status: str + :keyword type: Object status condition type for this object. + :paramtype type: str + """ super(ObjectStatusConditionDefinition, self).__init__(**kwargs) self.last_transition_time = last_transition_time self.message = message @@ -1403,26 +1746,26 @@ def __init__( class ObjectStatusDefinition(msrest.serialization.Model): """Statuses of objects deployed by the user-specified kustomizations from the git repository. - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied + :ivar name: Name of the applied object. + :vartype name: str + :ivar namespace: Namespace of the applied object. + :vartype namespace: str + :ivar kind: Kind of the applied object. + :vartype kind: str + :ivar compliance_state: Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: "Compliant", "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or + :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: + :ivar applied_by: Object reference to the Kustomization that applied this object. + :vartype applied_by: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: + :ivar status_conditions: List of Kubernetes object status conditions present on the cluster. + :vartype status_conditions: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the + :ivar helm_release_properties: Additional properties that are provided from objects of the HelmRelease kind. - :type helm_release_properties: + :vartype helm_release_properties: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmReleasePropertiesDefinition """ @@ -1448,6 +1791,29 @@ def __init__( helm_release_properties: Optional["HelmReleasePropertiesDefinition"] = None, **kwargs ): + """ + :keyword name: Name of the applied object. + :paramtype name: str + :keyword namespace: Namespace of the applied object. + :paramtype namespace: str + :keyword kind: Kind of the applied object. + :paramtype kind: str + :keyword compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :paramtype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState + :keyword applied_by: Object reference to the Kustomization that applied this object. + :paramtype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition + :keyword status_conditions: List of Kubernetes object status conditions present on the cluster. + :paramtype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusConditionDefinition] + :keyword helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :paramtype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmReleasePropertiesDefinition + """ super(ObjectStatusDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1484,6 +1850,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1496,14 +1864,14 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] :ivar error: If present, details of the operation error. :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail """ @@ -1530,6 +1898,16 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -1541,21 +1919,21 @@ def __init__( class PatchExtension(msrest.serialization.Model): """The Extension Patch Request object. - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -1576,6 +1954,23 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ super(PatchExtension, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -1587,16 +1982,16 @@ def __init__( class RepositoryRefDefinition(msrest.serialization.Model): """The source reference for the GitRepository object. - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to + :ivar branch: The git repository branch name to checkout. + :vartype branch: str + :ivar tag: The git repository tag name to checkout. This takes precedence over branch. + :vartype tag: str + :ivar semver: The semver range used to match against git repository tags. This takes precedence + over tag. + :vartype semver: str + :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. - :type commit: str + :vartype commit: str """ _attribute_map = { @@ -1615,6 +2010,18 @@ def __init__( commit: Optional[str] = None, **kwargs ): + """ + :keyword branch: The git repository branch name to checkout. + :paramtype branch: str + :keyword tag: The git repository tag name to checkout. This takes precedence over branch. + :paramtype tag: str + :keyword semver: The semver range used to match against git repository tags. This takes + precedence over tag. + :paramtype semver: str + :keyword commit: The commit SHA to checkout. This value must be combined with the branch name + to be valid. This takes precedence over semver. + :paramtype commit: str + """ super(RepositoryRefDefinition, self).__init__(**kwargs) self.branch = branch self.tag = tag @@ -1627,10 +2034,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -1657,6 +2064,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -1667,14 +2081,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -1693,6 +2107,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1705,8 +2129,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -1727,6 +2151,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1735,10 +2164,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -1753,6 +2183,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -1761,9 +2198,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -1776,6 +2213,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -1783,9 +2225,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -1798,6 +2240,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -1818,36 +2265,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -1903,6 +2350,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -1946,6 +2423,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1954,10 +2433,10 @@ def __init__( class SupportedScopes(msrest.serialization.Model): """Extension scopes. - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: + :ivar default_scope: Default extension scopes: cluster or namespace. + :vartype default_scope: str + :ivar cluster_scope_settings: Scope settings. + :vartype cluster_scope_settings: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterScopeSettings """ @@ -1973,6 +2452,13 @@ def __init__( cluster_scope_settings: Optional["ClusterScopeSettings"] = None, **kwargs ): + """ + :keyword default_scope: Default extension scopes: cluster or namespace. + :paramtype default_scope: str + :keyword cluster_scope_settings: Scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterScopeSettings + """ super(SupportedScopes, self).__init__(**kwargs) self.default_scope = default_scope self.cluster_scope_settings = cluster_scope_settings @@ -1981,22 +2467,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2019,6 +2505,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_source_control_configuration_client_enums.py index 1396bc813d4..9c16b817850 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_source_control_configuration_client_enums.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/models/_source_control_configuration_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ClusterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster types """ CONNECTED_CLUSTERS = "connectedClusters" MANAGED_CLUSTERS = "managedClusters" -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -43,7 +28,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,17 +37,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" - MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" - -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtensionsClusterResourceName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtensionsClusterRp(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" + MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" + +class FluxComplianceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compliance state of the cluster object. """ @@ -72,7 +57,7 @@ class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" UNKNOWN = "Unknown" -class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KustomizationValidationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. """ @@ -81,7 +66,7 @@ class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, CLIENT = "client" SERVER = "server" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -89,7 +74,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -97,20 +82,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource. """ @@ -121,7 +106,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" DELETING = "Deleting" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ @@ -131,14 +116,14 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" FAILED = "Failed" -class ScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the configuration will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class SourceKindType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceKindType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Source Kind to pull the configuration data from. """ diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_type_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_type_operations.py index 4392300f4a6..93725f6313e 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_type_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_type_operations.py @@ -5,22 +5,65 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClusterExtensionTypeOperations(object): """ClusterExtensionTypeOperations operations. @@ -44,26 +87,28 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionType" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": """Get Extension Type details. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -78,36 +123,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -116,4 +151,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_types_operations.py index 61a5f735fcc..3169d214744 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_cluster_extension_types_operations.py @@ -5,23 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClusterExtensionTypesOperations(object): """ClusterExtensionTypesOperations operations. @@ -45,30 +86,33 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """Get Extension Types. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -76,38 +120,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,12 +163,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extension_type_versions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extension_type_versions_operations.py index c4627a848b1..e377f228260 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extension_type_versions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extension_type_versions_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + location: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionTypeVersionsOperations(object): """ExtensionTypeVersionsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionVersionList"] + location: str, + extension_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionVersionList"]: """List available versions for an Extension Type. :param location: extension location. @@ -59,8 +96,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -68,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +146,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extensions_operations.py index 03f7f0ca45d..05b12aea127 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extensions_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_extensions_operations.py @@ -5,25 +5,253 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +277,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -110,29 +326,33 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +361,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +388,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -199,28 +414,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +453,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +481,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -348,10 +546,12 @@ def begin_delete( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +561,17 @@ def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -387,24 +589,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -416,60 +608,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -477,46 +658,55 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Patch an existing Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension :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. + :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. + :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -531,30 +721,21 @@ def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -566,32 +747,36 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -599,38 +784,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -643,12 +827,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py index ccb630e51f8..c2770443964 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py @@ -5,22 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FluxConfigOperationStatusOperations(object): """FluxConfigOperationStatusOperations operations. @@ -44,27 +89,29 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,37 +128,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -120,4 +157,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_configurations_operations.py index a2129c8a800..581995baf23 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_flux_configurations_operations.py @@ -5,25 +5,253 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FluxConfigurationsOperations(object): """FluxConfigurationsOperations operations. @@ -47,26 +275,28 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> "_models.FluxConfiguration": """Gets details of the Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,36 +311,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -119,60 +339,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(flux_configuration, 'FluxConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -184,46 +394,56 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Create a new Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -238,30 +458,21 @@ def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -273,60 +484,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -334,46 +534,56 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Update an existing Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch :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. + :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -388,30 +598,21 @@ def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FluxConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,74 +624,63 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the source repo. @@ -498,10 +688,12 @@ def begin_delete( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -511,15 +703,17 @@ def begin_delete( :type force_delete: bool :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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -537,24 +731,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -566,32 +750,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FluxConfigurationsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.FluxConfigurationsList"]: """List all Flux Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -599,38 +788,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -643,12 +831,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_location_extension_types_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_location_extension_types_operations.py index 454b01b9655..42c18809e53 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_location_extension_types_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_location_extension_types_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LocationExtensionTypesOperations(object): """LocationExtensionTypesOperations operations. @@ -45,19 +80,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """List all Extension Types. :param location: extension location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operation_status_operations.py index 4f88c2781a9..f4a859d24eb 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operation_status_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,27 +129,29 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -82,37 +168,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -121,32 +197,37 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -154,38 +235,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -198,12 +278,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operations.py index a52ba75a330..ba30bb53615 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_source_control_configurations_operations.py index 44412282d5a..fe3ef877c91 100644 --- a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_source_control_configurations_operations.py +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_01_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,33 +221,36 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +258,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,38 +286,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +331,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +368,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -276,25 +430,29 @@ def begin_delete( :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: 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. + :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. + :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,24 +469,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,32 +488,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.ExtensionsClusterRp"], + cluster_resource_name: Union[str, "_models.ExtensionsClusterResourceName"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 + :type cluster_rp: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterRp :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +526,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +569,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/__init__.py new file mode 100644 index 00000000000..e9096303633 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/__init__.py @@ -0,0 +1,18 @@ +# 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 ._source_control_configuration_client import SourceControlConfigurationClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_configuration.py new file mode 100644 index 00000000000..370fdc18d17 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_configuration.py @@ -0,0 +1,68 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SourceControlConfigurationClientConfiguration(Configuration): + """Configuration for SourceControlConfigurationClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2022-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-kubernetesconfiguration/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_source_control_configuration_client.py new file mode 100644 index 00000000000..afe78f7c5ab --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_source_control_configuration_client.py @@ -0,0 +1,113 @@ +# 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 copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class SourceControlConfigurationClient: + """KubernetesConfiguration Client. + + :ivar extensions: ExtensionsOperations operations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2022_03_01.operations.ExtensionsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2022_03_01.operations.OperationStatusOperations + :ivar flux_configurations: FluxConfigurationsOperations operations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2022_03_01.operations.FluxConfigurationsOperations + :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2022_03_01.operations.FluxConfigOperationStatusOperations + :ivar source_control_configurations: SourceControlConfigurationsOperations operations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2022_03_01.operations.SourceControlConfigurationsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.kubernetesconfiguration.v2022_03_01.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + 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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SourceControlConfigurationClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_vendor.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_version.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_version.py new file mode 100644 index 00000000000..59deb8c7263 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.1.0" diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/__init__.py new file mode 100644 index 00000000000..5f583276b4e --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._source_control_configuration_client import SourceControlConfigurationClient +__all__ = ['SourceControlConfigurationClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_configuration.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_configuration.py new file mode 100644 index 00000000000..5bb69c4da53 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SourceControlConfigurationClientConfiguration(Configuration): + """Configuration for SourceControlConfigurationClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2022-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-kubernetesconfiguration/{}'.format(VERSION)) + self._configure(**kwargs) + + 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) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_patch.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_source_control_configuration_client.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_source_control_configuration_client.py new file mode 100644 index 00000000000..9a5a755578b --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/_source_control_configuration_client.py @@ -0,0 +1,110 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class SourceControlConfigurationClient: + """KubernetesConfiguration Client. + + :ivar extensions: ExtensionsOperations operations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2022_03_01.aio.operations.ExtensionsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2022_03_01.aio.operations.OperationStatusOperations + :ivar flux_configurations: FluxConfigurationsOperations operations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2022_03_01.aio.operations.FluxConfigurationsOperations + :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2022_03_01.aio.operations.FluxConfigOperationStatusOperations + :ivar source_control_configurations: SourceControlConfigurationsOperations operations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2022_03_01.aio.operations.SourceControlConfigurationsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.kubernetesconfiguration.v2022_03_01.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + 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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SourceControlConfigurationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/__init__.py new file mode 100644 index 00000000000..e18b201b5dc --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 ._extensions_operations import ExtensionsOperations +from ._operation_status_operations import OperationStatusOperations +from ._flux_configurations_operations import FluxConfigurationsOperations +from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations +from ._source_control_configurations_operations import SourceControlConfigurationsOperations +from ._operations import Operations + +__all__ = [ + 'ExtensionsOperations', + 'OperationStatusOperations', + 'FluxConfigurationsOperations', + 'FluxConfigOperationStatusOperations', + 'SourceControlConfigurationsOperations', + 'Operations', +] diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_extensions_operations.py new file mode 100644 index 00000000000..bba4b3105d5 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_extensions_operations.py @@ -0,0 +1,604 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExtensionsOperations: + """ExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Extension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> AsyncLROPoller["_models.Extension"]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. + :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + extension=extension, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Extension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": + """Gets Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Extension, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension + from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. + :type force_delete: bool + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> AsyncLROPoller["_models.Extension"]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.PatchExtension + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + patch_extension=patch_extension, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Extension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionsList"]: + """List all Extensions in the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionsList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ExtensionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py new file mode 100644 index 00000000000..53766735ba9 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py @@ -0,0 +1,115 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._flux_config_operation_status_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FluxConfigOperationStatusOperations: + """FluxConfigOperationStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_configurations_operations.py new file mode 100644 index 00000000000..80b175ce087 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_flux_configurations_operations.py @@ -0,0 +1,607 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +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._flux_configurations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FluxConfigurationsOperations: + """FluxConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> "_models.FluxConfiguration": + """Gets details of the Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FluxConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> "_models.FluxConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration, 'FluxConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> AsyncLROPoller["_models.FluxConfiguration"]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration=flux_configuration, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> "_models.FluxConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> AsyncLROPoller["_models.FluxConfiguration"]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationPatch + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration_patch=flux_configuration_patch, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync + from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. + :type force_delete: bool + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.FluxConfigurationsList"]: + """List all Flux Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operation_status_operations.py new file mode 100644 index 00000000000..c190ec1e38b --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operation_status_operations.py @@ -0,0 +1,204 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusOperations: + """OperationStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.OperationStatusList"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationStatusList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operations.py new file mode 100644 index 00000000000..3131058170a --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_operations.py @@ -0,0 +1,111 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceProviderOperationList"]: + """List all the available operations the KubernetesConfiguration resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ResourceProviderOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_source_control_configurations_operations.py new file mode 100644 index 00000000000..71375d427f2 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/aio/operations/_source_control_configurations_operations.py @@ -0,0 +1,399 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SourceControlConfigurationsOperations: + """SourceControlConfigurationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": + """Gets details of the Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. + :type source_control_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This will delete the YAML file used to set up the Source control configuration, thus stopping + future sync from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. + :type source_control_configuration_name: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SourceControlConfigurationList"]: + """List all Source Control Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfigurationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/__init__.py new file mode 100644 index 00000000000..2bd4f2cd929 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/__init__.py @@ -0,0 +1,117 @@ +# 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 ._models_py3 import BucketDefinition +from ._models_py3 import BucketPatchDefinition +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionsList +from ._models_py3 import FluxConfiguration +from ._models_py3 import FluxConfigurationPatch +from ._models_py3 import FluxConfigurationsList +from ._models_py3 import GitRepositoryDefinition +from ._models_py3 import GitRepositoryPatchDefinition +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import HelmReleasePropertiesDefinition +from ._models_py3 import Identity +from ._models_py3 import KustomizationDefinition +from ._models_py3 import KustomizationPatchDefinition +from ._models_py3 import ObjectReferenceDefinition +from ._models_py3 import ObjectStatusConditionDefinition +from ._models_py3 import ObjectStatusDefinition +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import RepositoryRefDefinition +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + + +from ._source_control_configuration_client_enums import ( + AKSIdentityType, + ComplianceStateType, + CreatedByType, + FluxComplianceState, + KustomizationValidationType, + LevelType, + MessageLevelType, + OperatorScopeType, + OperatorType, + ProvisioningState, + ProvisioningStateType, + ScopeType, + SourceKindType, +) + +__all__ = [ + 'BucketDefinition', + 'BucketPatchDefinition', + 'ComplianceStatus', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'Extension', + 'ExtensionPropertiesAksAssignedIdentity', + 'ExtensionStatus', + 'ExtensionsList', + 'FluxConfiguration', + 'FluxConfigurationPatch', + 'FluxConfigurationsList', + 'GitRepositoryDefinition', + 'GitRepositoryPatchDefinition', + 'HelmOperatorProperties', + 'HelmReleasePropertiesDefinition', + 'Identity', + 'KustomizationDefinition', + 'KustomizationPatchDefinition', + 'ObjectReferenceDefinition', + 'ObjectStatusConditionDefinition', + 'ObjectStatusDefinition', + 'OperationStatusList', + 'OperationStatusResult', + 'PatchExtension', + 'ProxyResource', + 'RepositoryRefDefinition', + 'Resource', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperationList', + 'Scope', + 'ScopeCluster', + 'ScopeNamespace', + 'SourceControlConfiguration', + 'SourceControlConfigurationList', + 'SystemData', + 'AKSIdentityType', + 'ComplianceStateType', + 'CreatedByType', + 'FluxComplianceState', + 'KustomizationValidationType', + 'LevelType', + 'MessageLevelType', + 'OperatorScopeType', + 'OperatorType', + 'ProvisioningState', + 'ProvisioningStateType', + 'ScopeType', + 'SourceKindType', +] diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_models_py3.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_models_py3.py new file mode 100644 index 00000000000..6378d3e0d25 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_models_py3.py @@ -0,0 +1,2268 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._source_control_configuration_client_enums import * + + +class BucketDefinition(msrest.serialization.Model): + """Parameters to reconcile to the GitRepository source kind type. + + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + source with the remote. + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :vartype sync_interval_in_seconds: long + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + 'bucket_name': {'key': 'bucketName', 'type': 'str'}, + 'insecure': {'key': 'insecure', 'type': 'bool'}, + 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, + 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, + 'access_key': {'key': 'accessKey', 'type': 'str'}, + 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + bucket_name: Optional[str] = None, + insecure: Optional[bool] = True, + timeout_in_seconds: Optional[int] = 600, + sync_interval_in_seconds: Optional[int] = 600, + access_key: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super(BucketDefinition, self).__init__(**kwargs) + self.url = url + self.bucket_name = bucket_name + self.insecure = insecure + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.access_key = access_key + self.local_auth_ref = local_auth_ref + + +class BucketPatchDefinition(msrest.serialization.Model): + """Parameters to reconcile to the GitRepository source kind type. + + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + source with the remote. + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :vartype sync_interval_in_seconds: long + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + 'bucket_name': {'key': 'bucketName', 'type': 'str'}, + 'insecure': {'key': 'insecure', 'type': 'bool'}, + 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, + 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, + 'access_key': {'key': 'accessKey', 'type': 'str'}, + 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + bucket_name: Optional[str] = None, + insecure: Optional[bool] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + access_key: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super(BucketPatchDefinition, self).__init__(**kwargs) + self.url = url + self.bucket_name = bucket_name + self.insecure = insecure + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.access_key = access_key + self.local_auth_ref = local_auth_ref + + +class ComplianceStatus(msrest.serialization.Model): + """Compliance Status details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar compliance_state: The compliance state of the configuration. Possible values include: + "Pending", "Compliant", "Noncompliant", "Installed", "Failed". + :vartype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ComplianceStateType + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :vartype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.MessageLevelType + """ + + _validation = { + 'compliance_state': {'readonly': True}, + } + + _attribute_map = { + 'compliance_state': {'key': 'complianceState', 'type': 'str'}, + 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, + 'message': {'key': 'message', 'type': 'str'}, + 'message_level': {'key': 'messageLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + last_config_applied: Optional[datetime.datetime] = None, + message: Optional[str] = None, + message_level: Optional[Union[str, "MessageLevelType"]] = None, + **kwargs + ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.MessageLevelType + """ + super(ComplianceStatus, self).__init__(**kwargs) + self.compliance_state = None + self.last_config_applied = last_config_applied + self.message = message + self.message_level = message_level + + +class ErrorAdditionalInfo(msrest.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: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.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.kubernetesconfiguration.v2022_03_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.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 + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.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.kubernetesconfiguration.v2022_03_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class Extension(ProxyResource): + """The Extension object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Identity + :ivar system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SystemData + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + of minor version, or not. + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: User-specified version of the extension for this extension to 'pin'. To use + 'version', autoUpgradeMinorVersion must be 'false'. + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this + extension. + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :vartype configuration_protected_settings: dict[str, str] + :ivar installed_version: Installed version of the extension. + :vartype installed_version: str + :ivar provisioning_state: Status of installation of this extension. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ProvisioningState + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ExtensionStatus] + :ivar error_info: Error information from the Agent - e.g. errors during installation. + :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ErrorDetail + :ivar custom_location_settings: Custom Location settings properties. + :vartype custom_location_settings: dict[str, str] + :ivar package_uri: Uri of the Helm package. + :vartype package_uri: str + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ExtensionPropertiesAksAssignedIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'installed_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'error_info': {'readonly': True}, + 'custom_location_settings': {'readonly': True}, + 'package_uri': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'Scope'}, + 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, + 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, + 'installed_version': {'key': 'properties.installedVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, + 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, + 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, + 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, + 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, + } + + def __init__( + self, + *, + identity: Optional["Identity"] = None, + extension_type: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = True, + release_train: Optional[str] = "Stable", + version: Optional[str] = None, + scope: Optional["Scope"] = None, + configuration_settings: Optional[Dict[str, str]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + statuses: Optional[List["ExtensionStatus"]] = None, + aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, + **kwargs + ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: User-specified version of the extension for this extension to 'pin'. To use + 'version', autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ExtensionStatus] + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ExtensionPropertiesAksAssignedIdentity + """ + super(Extension, self).__init__(**kwargs) + self.identity = identity + self.system_data = None + self.extension_type = extension_type + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.release_train = release_train + self.version = version + self.scope = scope + self.configuration_settings = configuration_settings + self.configuration_protected_settings = configuration_protected_settings + self.installed_version = None + self.provisioning_state = None + self.statuses = statuses + self.error_info = None + self.custom_location_settings = None + self.package_uri = None + self.aks_assigned_identity = aks_assigned_identity + + +class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): + """Identity of the Extension resource in an AKS cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Possible values include: "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.AKSIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "AKSIdentityType"]] = None, + **kwargs + ): + """ + :keyword type: The identity type. Possible values include: "SystemAssigned", "UserAssigned". + :paramtype type: str or ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.AKSIdentityType + """ + super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class ExtensionsList(msrest.serialization.Model): + """Result of the request to list Extensions. It contains a list of Extension objects 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. + + :ivar value: List of Extensions within a Kubernetes cluster. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension] + :ivar next_link: URL to get the next set of extension objects, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Extension]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ExtensionsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ExtensionStatus(msrest.serialization.Model): + """Status from the extension. + + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". + Default value: "Information". + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'time': {'key': 'time', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + display_status: Optional[str] = None, + level: Optional[Union[str, "LevelType"]] = "Information", + message: Optional[str] = None, + time: Optional[str] = None, + **kwargs + ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ + super(ExtensionStatus, self).__init__(**kwargs) + self.code = code + self.display_status = display_status + self.level = level + self.message = message + self.time = time + + +class FluxConfiguration(ProxyResource): + """The Flux Configuration object returned in Get & Put response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SystemData + :ivar scope: Scope at which the operator will be installed. Possible values include: "cluster", + "namespace". Default value: "cluster". + :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ScopeType + :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :vartype namespace: str + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :vartype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceKindType + :ivar suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.GitRepositoryDefinition + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.BucketDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :vartype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.KustomizationDefinition] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] + :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or + created by the managed objects provisioned by the fluxConfiguration. + :vartype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectStatusDefinition] + :ivar repository_public_key: Public Key associated with this fluxConfiguration (either + generated within the cluster or provided by the user). + :vartype repository_public_key: str + :ivar source_synced_commit_id: Branch and/or SHA of the source commit synced with the cluster. + :vartype source_synced_commit_id: str + :ivar source_updated_at: Datetime the fluxConfiguration synced its source on the cluster. + :vartype source_updated_at: ~datetime.datetime + :ivar status_updated_at: Datetime the fluxConfiguration synced its status on the cluster with + Azure. + :vartype status_updated_at: ~datetime.datetime + :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the + fluxConfiguration or created by the managed objects. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :vartype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxComplianceState + :ivar provisioning_state: Status of the creation of the fluxConfiguration. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ProvisioningState + :ivar error_message: Error message returned to the user in the case of provisioning failure. + :vartype error_message: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'statuses': {'readonly': True}, + 'repository_public_key': {'readonly': True}, + 'source_synced_commit_id': {'readonly': True}, + 'source_updated_at': {'readonly': True}, + 'status_updated_at': {'readonly': True}, + 'compliance_state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'error_message': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'namespace': {'key': 'properties.namespace', 'type': 'str'}, + 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, + 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, + 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, + 'bucket': {'key': 'properties.bucket', 'type': 'BucketDefinition'}, + 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, + 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, + 'statuses': {'key': 'properties.statuses', 'type': '[ObjectStatusDefinition]'}, + 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, + 'source_synced_commit_id': {'key': 'properties.sourceSyncedCommitId', 'type': 'str'}, + 'source_updated_at': {'key': 'properties.sourceUpdatedAt', 'type': 'iso-8601'}, + 'status_updated_at': {'key': 'properties.statusUpdatedAt', 'type': 'iso-8601'}, + 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + scope: Optional[Union[str, "ScopeType"]] = "cluster", + namespace: Optional[str] = "default", + source_kind: Optional[Union[str, "SourceKindType"]] = None, + suspend: Optional[bool] = False, + git_repository: Optional["GitRepositoryDefinition"] = None, + bucket: Optional["BucketDefinition"] = None, + kustomizations: Optional[Dict[str, "KustomizationDefinition"]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword scope: Scope at which the operator will be installed. Possible values include: + "cluster", "namespace". Default value: "cluster". + :paramtype scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ScopeType + :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :paramtype namespace: str + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.GitRepositoryDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.BucketDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ + super(FluxConfiguration, self).__init__(**kwargs) + self.system_data = None + self.scope = scope + self.namespace = namespace + self.source_kind = source_kind + self.suspend = suspend + self.git_repository = git_repository + self.bucket = bucket + self.kustomizations = kustomizations + self.configuration_protected_settings = configuration_protected_settings + self.statuses = None + self.repository_public_key = None + self.source_synced_commit_id = None + self.source_updated_at = None + self.status_updated_at = None + self.compliance_state = None + self.provisioning_state = None + self.error_message = None + + +class FluxConfigurationPatch(msrest.serialization.Model): + """The Flux Configuration Patch Request object. + + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :vartype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceKindType + :ivar suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.GitRepositoryPatchDefinition + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.BucketPatchDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :vartype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.KustomizationPatchDefinition] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] + """ + + _attribute_map = { + 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, + 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, + 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryPatchDefinition'}, + 'bucket': {'key': 'properties.bucket', 'type': 'BucketPatchDefinition'}, + 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationPatchDefinition}'}, + 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, + } + + def __init__( + self, + *, + source_kind: Optional[Union[str, "SourceKindType"]] = None, + suspend: Optional[bool] = None, + git_repository: Optional["GitRepositoryPatchDefinition"] = None, + bucket: Optional["BucketPatchDefinition"] = None, + kustomizations: Optional[Dict[str, "KustomizationPatchDefinition"]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.GitRepositoryPatchDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.BucketPatchDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.KustomizationPatchDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ + super(FluxConfigurationPatch, self).__init__(**kwargs) + self.source_kind = source_kind + self.suspend = suspend + self.git_repository = git_repository + self.bucket = bucket + self.kustomizations = kustomizations + self.configuration_protected_settings = configuration_protected_settings + + +class FluxConfigurationsList(msrest.serialization.Model): + """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration objects 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. + + :ivar value: List of Flux Configurations within a Kubernetes cluster. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration] + :ivar next_link: URL to get the next set of configuration objects, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FluxConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FluxConfigurationsList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class GitRepositoryDefinition(msrest.serialization.Model): + """Parameters to reconcile to the GitRepository source kind type. + + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + source with the remote. + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.RepositoryRefDefinition + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + access private git repositories over SSH. + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, + 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, + 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, + 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, + 'https_user': {'key': 'httpsUser', 'type': 'str'}, + 'https_ca_cert': {'key': 'httpsCACert', 'type': 'str'}, + 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + timeout_in_seconds: Optional[int] = 600, + sync_interval_in_seconds: Optional[int] = 600, + repository_ref: Optional["RepositoryRefDefinition"] = None, + ssh_known_hosts: Optional[str] = None, + https_user: Optional[str] = None, + https_ca_cert: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super(GitRepositoryDefinition, self).__init__(**kwargs) + self.url = url + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.repository_ref = repository_ref + self.ssh_known_hosts = ssh_known_hosts + self.https_user = https_user + self.https_ca_cert = https_ca_cert + self.local_auth_ref = local_auth_ref + + +class GitRepositoryPatchDefinition(msrest.serialization.Model): + """Parameters to reconcile to the GitRepository source kind type. + + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + source with the remote. + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.RepositoryRefDefinition + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + access private git repositories over SSH. + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, + 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, + 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, + 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, + 'https_user': {'key': 'httpsUser', 'type': 'str'}, + 'https_ca_cert': {'key': 'httpsCACert', 'type': 'str'}, + 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + repository_ref: Optional["RepositoryRefDefinition"] = None, + ssh_known_hosts: Optional[str] = None, + https_user: Optional[str] = None, + https_ca_cert: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super(GitRepositoryPatchDefinition, self).__init__(**kwargs) + self.url = url + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.repository_ref = repository_ref + self.ssh_known_hosts = ssh_known_hosts + self.https_user = https_user + self.https_ca_cert = https_ca_cert + self.local_auth_ref = local_auth_ref + + +class HelmOperatorProperties(msrest.serialization.Model): + """Properties for Helm operator. + + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str + """ + + _attribute_map = { + 'chart_version': {'key': 'chartVersion', 'type': 'str'}, + 'chart_values': {'key': 'chartValues', 'type': 'str'}, + } + + def __init__( + self, + *, + chart_version: Optional[str] = None, + chart_values: Optional[str] = None, + **kwargs + ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ + super(HelmOperatorProperties, self).__init__(**kwargs) + self.chart_version = chart_version + self.chart_values = chart_values + + +class HelmReleasePropertiesDefinition(msrest.serialization.Model): + """Properties for HelmRelease objects. + + :ivar last_revision_applied: The revision number of the last released object change. + :vartype last_revision_applied: long + :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :vartype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectReferenceDefinition + :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade. + :vartype failure_count: long + :ivar install_failure_count: Number of times that the HelmRelease failed to install. + :vartype install_failure_count: long + :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :vartype upgrade_failure_count: long + """ + + _attribute_map = { + 'last_revision_applied': {'key': 'lastRevisionApplied', 'type': 'long'}, + 'helm_chart_ref': {'key': 'helmChartRef', 'type': 'ObjectReferenceDefinition'}, + 'failure_count': {'key': 'failureCount', 'type': 'long'}, + 'install_failure_count': {'key': 'installFailureCount', 'type': 'long'}, + 'upgrade_failure_count': {'key': 'upgradeFailureCount', 'type': 'long'}, + } + + def __init__( + self, + *, + last_revision_applied: Optional[int] = None, + helm_chart_ref: Optional["ObjectReferenceDefinition"] = None, + failure_count: Optional[int] = None, + install_failure_count: Optional[int] = None, + upgrade_failure_count: Optional[int] = None, + **kwargs + ): + """ + :keyword last_revision_applied: The revision number of the last released object change. + :paramtype last_revision_applied: long + :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :paramtype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectReferenceDefinition + :keyword failure_count: Total number of times that the HelmRelease failed to install or + upgrade. + :paramtype failure_count: long + :keyword install_failure_count: Number of times that the HelmRelease failed to install. + :paramtype install_failure_count: long + :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :paramtype upgrade_failure_count: long + """ + super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) + self.last_revision_applied = last_revision_applied + self.helm_chart_ref = helm_chart_ref + self.failure_count = failure_count + self.install_failure_count = install_failure_count + self.upgrade_failure_count = upgrade_failure_count + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :vartype type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + **kwargs + ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class KustomizationDefinition(msrest.serialization.Model): + """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Kustomization, matching the key in the Kustomizations object map. + :vartype name: str + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :vartype depends_on: list[str] + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster. + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, + 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, + 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, + 'prune': {'key': 'prune', 'type': 'bool'}, + 'force': {'key': 'force', 'type': 'bool'}, + } + + def __init__( + self, + *, + path: Optional[str] = "", + depends_on: Optional[List[str]] = None, + timeout_in_seconds: Optional[int] = 600, + sync_interval_in_seconds: Optional[int] = 600, + retry_interval_in_seconds: Optional[int] = None, + prune: Optional[bool] = False, + force: Optional[bool] = False, + **kwargs + ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: list[str] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ + super(KustomizationDefinition, self).__init__(**kwargs) + self.name = None + self.path = path + self.depends_on = depends_on + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.retry_interval_in_seconds = retry_interval_in_seconds + self.prune = prune + self.force = force + + +class KustomizationPatchDefinition(msrest.serialization.Model): + """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. + + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :vartype depends_on: list[str] + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster. + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'depends_on': {'key': 'dependsOn', 'type': '[str]'}, + 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, + 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, + 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, + 'prune': {'key': 'prune', 'type': 'bool'}, + 'force': {'key': 'force', 'type': 'bool'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + depends_on: Optional[List[str]] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + retry_interval_in_seconds: Optional[int] = None, + prune: Optional[bool] = None, + force: Optional[bool] = None, + **kwargs + ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: list[str] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ + super(KustomizationPatchDefinition, self).__init__(**kwargs) + self.path = path + self.depends_on = depends_on + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.retry_interval_in_seconds = retry_interval_in_seconds + self.prune = prune + self.force = force + + +class ObjectReferenceDefinition(msrest.serialization.Model): + """Object reference to a Kubernetes object on a cluster. + + :ivar name: Name of the object. + :vartype name: str + :ivar namespace: Namespace of the object. + :vartype namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the object. + :paramtype name: str + :keyword namespace: Namespace of the object. + :paramtype namespace: str + """ + super(ObjectReferenceDefinition, self).__init__(**kwargs) + self.name = name + self.namespace = namespace + + +class ObjectStatusConditionDefinition(msrest.serialization.Model): + """Status condition of Kubernetes object. + + :ivar last_transition_time: Last time this status condition has changed. + :vartype last_transition_time: ~datetime.datetime + :ivar message: A more verbose description of the object status condition. + :vartype message: str + :ivar reason: Reason for the specified status condition type status. + :vartype reason: str + :ivar status: Status of the Kubernetes object condition type. + :vartype status: str + :ivar type: Object status condition type for this object. + :vartype type: str + """ + + _attribute_map = { + 'last_transition_time': {'key': 'lastTransitionTime', 'type': 'iso-8601'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + last_transition_time: Optional[datetime.datetime] = None, + message: Optional[str] = None, + reason: Optional[str] = None, + status: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + """ + :keyword last_transition_time: Last time this status condition has changed. + :paramtype last_transition_time: ~datetime.datetime + :keyword message: A more verbose description of the object status condition. + :paramtype message: str + :keyword reason: Reason for the specified status condition type status. + :paramtype reason: str + :keyword status: Status of the Kubernetes object condition type. + :paramtype status: str + :keyword type: Object status condition type for this object. + :paramtype type: str + """ + super(ObjectStatusConditionDefinition, self).__init__(**kwargs) + self.last_transition_time = last_transition_time + self.message = message + self.reason = reason + self.status = status + self.type = type + + +class ObjectStatusDefinition(msrest.serialization.Model): + """Statuses of objects deployed by the user-specified kustomizations from the git repository. + + :ivar name: Name of the applied object. + :vartype name: str + :ivar namespace: Namespace of the applied object. + :vartype namespace: str + :ivar kind: Kind of the applied object. + :vartype kind: str + :ivar compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :vartype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxComplianceState + :ivar applied_by: Object reference to the Kustomization that applied this object. + :vartype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectReferenceDefinition + :ivar status_conditions: List of Kubernetes object status conditions present on the cluster. + :vartype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectStatusConditionDefinition] + :ivar helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :vartype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.HelmReleasePropertiesDefinition + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'compliance_state': {'key': 'complianceState', 'type': 'str'}, + 'applied_by': {'key': 'appliedBy', 'type': 'ObjectReferenceDefinition'}, + 'status_conditions': {'key': 'statusConditions', 'type': '[ObjectStatusConditionDefinition]'}, + 'helm_release_properties': {'key': 'helmReleaseProperties', 'type': 'HelmReleasePropertiesDefinition'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + kind: Optional[str] = None, + compliance_state: Optional[Union[str, "FluxComplianceState"]] = "Unknown", + applied_by: Optional["ObjectReferenceDefinition"] = None, + status_conditions: Optional[List["ObjectStatusConditionDefinition"]] = None, + helm_release_properties: Optional["HelmReleasePropertiesDefinition"] = None, + **kwargs + ): + """ + :keyword name: Name of the applied object. + :paramtype name: str + :keyword namespace: Namespace of the applied object. + :paramtype namespace: str + :keyword kind: Kind of the applied object. + :paramtype kind: str + :keyword compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :paramtype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxComplianceState + :keyword applied_by: Object reference to the Kustomization that applied this object. + :paramtype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectReferenceDefinition + :keyword status_conditions: List of Kubernetes object status conditions present on the cluster. + :paramtype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ObjectStatusConditionDefinition] + :keyword helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :paramtype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.HelmReleasePropertiesDefinition + """ + super(ObjectStatusDefinition, self).__init__(**kwargs) + self.name = name + self.namespace = namespace + self.kind = kind + self.compliance_state = compliance_state + self.applied_by = applied_by + self.status_conditions = status_conditions + self.helm_release_properties = helm_release_properties + + +class OperationStatusList(msrest.serialization.Model): + """The async operations in progress, in the cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of async operations in progress, in the cluster. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult] + :ivar next_link: URL to get the next set of Operation Result objects, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationStatusList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(msrest.serialization.Model): + """The current status of an async operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ErrorDetail + """ + + _validation = { + 'status': {'required': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, + name: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ + super(OperationStatusResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.properties = properties + self.error = None + + +class PatchExtension(msrest.serialization.Model): + """The Extension Patch Request object. + + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + of minor version, or not. + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this + extension. + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :vartype configuration_protected_settings: dict[str, str] + """ + + _attribute_map = { + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, + 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, + } + + def __init__( + self, + *, + auto_upgrade_minor_version: Optional[bool] = True, + release_train: Optional[str] = "Stable", + version: Optional[str] = None, + configuration_settings: Optional[Dict[str, str]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ + super(PatchExtension, self).__init__(**kwargs) + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.release_train = release_train + self.version = version + self.configuration_settings = configuration_settings + self.configuration_protected_settings = configuration_protected_settings + + +class RepositoryRefDefinition(msrest.serialization.Model): + """The source reference for the GitRepository object. + + :ivar branch: The git repository branch name to checkout. + :vartype branch: str + :ivar tag: The git repository tag name to checkout. This takes precedence over branch. + :vartype tag: str + :ivar semver: The semver range used to match against git repository tags. This takes precedence + over tag. + :vartype semver: str + :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to + be valid. This takes precedence over semver. + :vartype commit: str + """ + + _attribute_map = { + 'branch': {'key': 'branch', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'semver': {'key': 'semver', 'type': 'str'}, + 'commit': {'key': 'commit', 'type': 'str'}, + } + + def __init__( + self, + *, + branch: Optional[str] = None, + tag: Optional[str] = None, + semver: Optional[str] = None, + commit: Optional[str] = None, + **kwargs + ): + """ + :keyword branch: The git repository branch name to checkout. + :paramtype branch: str + :keyword tag: The git repository tag name to checkout. This takes precedence over branch. + :paramtype tag: str + :keyword semver: The semver range used to match against git repository tags. This takes + precedence over tag. + :paramtype semver: str + :keyword commit: The commit SHA to checkout. This value must be combined with the branch name + to be valid. This takes precedence over semver. + :paramtype commit: str + """ + super(RepositoryRefDefinition, self).__init__(**kwargs) + self.branch = branch + self.tag = tag + self.semver = semver + self.commit = commit + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operation of this resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ResourceProviderOperationDisplay + :ivar is_data_action: The flag that indicates whether the operation applies to data plane. + :vartype is_data_action: bool + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + _validation = { + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["ResourceProviderOperationDisplay"] = None, + **kwargs + ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ResourceProviderOperationDisplay + """ + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = name + self.display = display + self.is_data_action = None + self.origin = None + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(msrest.serialization.Model): + """Result of the request to list operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by this resource provider. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ResourceProviderOperation] + :ivar next_link: URL to the next set of results, if any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderOperation"]] = None, + **kwargs + ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ResourceProviderOperation] + """ + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Scope(msrest.serialization.Model): + """Scope of the extension. It can be either Cluster or Namespace; but not both. + + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ScopeNamespace + """ + + _attribute_map = { + 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, + 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, + } + + def __init__( + self, + *, + cluster: Optional["ScopeCluster"] = None, + namespace: Optional["ScopeNamespace"] = None, + **kwargs + ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ScopeNamespace + """ + super(Scope, self).__init__(**kwargs) + self.cluster = cluster + self.namespace = namespace + + +class ScopeCluster(msrest.serialization.Model): + """Specifies that the scope of the extension is Cluster. + + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :vartype release_namespace: str + """ + + _attribute_map = { + 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, + } + + def __init__( + self, + *, + release_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ + super(ScopeCluster, self).__init__(**kwargs) + self.release_namespace = release_namespace + + +class ScopeNamespace(msrest.serialization.Model): + """Specifies that the scope of the extension is Namespace. + + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped + extension. If this namespace does not exist, it will be created. + :vartype target_namespace: str + """ + + _attribute_map = { + 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ + super(ScopeNamespace, self).__init__(**kwargs) + self.target_namespace = target_namespace + + +class SourceControlConfiguration(ProxyResource): + """The SourceControl Configuration object returned in Get & Put response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SystemData + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperatorType + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: + "cluster", "namespace". Default value: "cluster". + :vartype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperatorScopeType + :ivar repository_public_key: Public Key associated with this SourceControl configuration + (either generated within the cluster or provided by the user). + :vartype repository_public_key: str + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + required to access private Git instances. + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.HelmOperatorProperties + :ivar provisioning_state: The provisioning state of the resource provider. Possible values + include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ProvisioningStateType + :ivar compliance_status: Compliance Status of the Configuration. + :vartype compliance_status: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ComplianceStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'repository_public_key': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'compliance_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, + 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, + 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, + 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, + 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, + 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, + 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, + 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, + 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, + 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, + 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, + } + + def __init__( + self, + *, + repository_url: Optional[str] = None, + operator_namespace: Optional[str] = "default", + operator_instance_name: Optional[str] = None, + operator_type: Optional[Union[str, "OperatorType"]] = None, + operator_params: Optional[str] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + operator_scope: Optional[Union[str, "OperatorScopeType"]] = "cluster", + ssh_known_hosts_contents: Optional[str] = None, + enable_helm_operator: Optional[bool] = None, + helm_operator_properties: Optional["HelmOperatorProperties"] = None, + **kwargs + ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.HelmOperatorProperties + """ + super(SourceControlConfiguration, self).__init__(**kwargs) + self.system_data = None + self.repository_url = repository_url + self.operator_namespace = operator_namespace + self.operator_instance_name = operator_instance_name + self.operator_type = operator_type + self.operator_params = operator_params + self.configuration_protected_settings = configuration_protected_settings + self.operator_scope = operator_scope + self.repository_public_key = None + self.ssh_known_hosts_contents = ssh_known_hosts_contents + self.enable_helm_operator = enable_helm_operator + self.helm_operator_properties = helm_operator_properties + self.provisioning_state = None + self.compliance_status = None + + +class SourceControlConfigurationList(msrest.serialization.Model): + """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects 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. + + :ivar value: List of Source Control Configurations within a Kubernetes cluster. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration] + :ivar next_link: URL to get the next set of configuration objects, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SourceControlConfigurationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_source_control_configuration_client_enums.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_source_control_configuration_client_enums.py new file mode 100644 index 00000000000..928602199b0 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/models/_source_control_configuration_client_enums.py @@ -0,0 +1,121 @@ +# 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 enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class AKSIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The compliance state of the configuration. + """ + + PENDING = "Pending" + COMPLIANT = "Compliant" + NONCOMPLIANT = "Noncompliant" + INSTALLED = "Installed" + FAILED = "Failed" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class FluxComplianceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Compliance state of the cluster object. + """ + + COMPLIANT = "Compliant" + NON_COMPLIANT = "Non-Compliant" + PENDING = "Pending" + SUSPENDED = "Suspended" + UNKNOWN = "Unknown" + +class KustomizationValidationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specify whether to validate the Kubernetes objects referenced in the Kustomization before + applying them to the cluster. + """ + + NONE = "none" + CLIENT = "client" + SERVER = "server" + +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Level of the status. + """ + + ERROR = "Error" + WARNING = "Warning" + INFORMATION = "Information" + +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Level of the message. + """ + + ERROR = "Error" + WARNING = "Warning" + INFORMATION = "Information" + +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Scope at which the operator will be installed. + """ + + CLUSTER = "cluster" + NAMESPACE = "namespace" + +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the operator + """ + + FLUX = "Flux" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of the resource. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of the resource provider. + """ + + ACCEPTED = "Accepted" + DELETING = "Deleting" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class ScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Scope at which the configuration will be installed. + """ + + CLUSTER = "cluster" + NAMESPACE = "namespace" + +class SourceKindType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Source Kind to pull the configuration data from. + """ + + GIT_REPOSITORY = "GitRepository" + BUCKET = "Bucket" diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/__init__.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/__init__.py new file mode 100644 index 00000000000..e18b201b5dc --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 ._extensions_operations import ExtensionsOperations +from ._operation_status_operations import OperationStatusOperations +from ._flux_configurations_operations import FluxConfigurationsOperations +from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations +from ._source_control_configurations_operations import SourceControlConfigurationsOperations +from ._operations import Operations + +__all__ = [ + 'ExtensionsOperations', + 'OperationStatusOperations', + 'FluxConfigurationsOperations', + 'FluxConfigOperationStatusOperations', + 'SourceControlConfigurationsOperations', + 'Operations', +] diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_extensions_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_extensions_operations.py new file mode 100644 index 00000000000..5ebf5788b77 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_extensions_operations.py @@ -0,0 +1,829 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +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.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ExtensionsOperations(object): + """ExtensionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Extension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. + :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension + :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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + extension=extension, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Extension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": + """Gets Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Extension, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension + from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. + :type force_delete: bool + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(patch_extension, 'PatchExtension') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.PatchExtension + :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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + patch_extension=patch_extension, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Extension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: + """List all Extensions in the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionsList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ExtensionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_config_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_config_operation_status_operations.py new file mode 100644 index 00000000000..aa9a53eca61 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_config_operation_status_operations.py @@ -0,0 +1,160 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class FluxConfigOperationStatusOperations(object): + """FluxConfigOperationStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_configurations_operations.py new file mode 100644 index 00000000000..cb2bddb55aa --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_flux_configurations_operations.py @@ -0,0 +1,834 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +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.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class FluxConfigurationsOperations(object): + """FluxConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> "_models.FluxConfiguration": + """Gets details of the Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FluxConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> "_models.FluxConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration, 'FluxConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration=flux_configuration, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> "_models.FluxConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationPatch + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration_patch=flux_configuration_patch, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('FluxConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync + from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. + :type flux_configuration_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. + :type force_delete: bool + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.FluxConfigurationsList"]: + """List all Flux Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operation_status_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operation_status_operations.py new file mode 100644 index 00000000000..74483698fc0 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operation_status_operations.py @@ -0,0 +1,287 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class OperationStatusOperations(object): + """OperationStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationStatusList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operations.py new file mode 100644 index 00000000000..71758018e4f --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_operations.py @@ -0,0 +1,137 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: + """List all the available operations the KubernetesConfiguration resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.ResourceProviderOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore diff --git a/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_source_control_configurations_operations.py b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_source_control_configurations_operations.py new file mode 100644 index 00000000000..300824b2190 --- /dev/null +++ b/src/k8s-configuration/azext_k8s_configuration/vendored_sdks/v2022_03_01/operations/_source_control_configurations_operations.py @@ -0,0 +1,572 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +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.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class SourceControlConfigurationsOperations(object): + """SourceControlConfigurationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": + """Gets details of the Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. + :type source_control_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_configuration, 'SourceControlConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This will delete the YAML file used to set up the Source control configuration, thus stopping + future sync from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. + :type source_control_configuration_name: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: + """List all Source Control Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfigurationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + 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(request, stream=False, **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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations'} # type: ignore diff --git a/src/k8s-configuration/setup.py b/src/k8s-configuration/setup.py index 5d94b005da4..cc7080203c8 100644 --- a/src/k8s-configuration/setup.py +++ b/src/k8s-configuration/setup.py @@ -16,7 +16,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") -VERSION = "1.4.1" +VERSION = "1.5.0" # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers