Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDKs with Updated Swagger Spec for 2020-07-01-preview #13

Merged
merged 4 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 11 additions & 59 deletions src/k8s-extension/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,33 @@
Release History
===============

0.1.0
++++++++++++++++++
* Initial release.

0.1.1
++++++++++++++++++
* Add support for microsoft-azure-defender extension type

0.1.2
++++++++++++++++++

* Add support for Arc Appliance cluster type

0.1.3
++++++++++++++++++

* Customization for microsoft.openservicemesh

0.1PP.4
0.2.0
jonathan-innis marked this conversation as resolved.
Show resolved Hide resolved
++++++++++++++++++

* Refactor for clear separation of extension-type specific customizations
* Introduce new versioning scheme to allow Preview releases by Partners

0.1PP.5
++++++++++++++++++

* OpenServiceMesh customization.
* If Version is passed in, accept None for AutoUpgradeMinorVersion, and not require it to be False.

0.1PP.6
++++++++++++++++++

* OpenServiceMesh customization.
* Scope is always cluster. Version is mandatory for staging and pilot release-trains.

0.1PP.7
++++++++++++++++++

* Fix clusterType of Microsoft.ResourceConnector resource

0.1PP.8
++++++++++++++++++

* Update clusterType validation to allow 'appliances'
* Update identity creation to use the appropriate parent resource's type and api-version
* Throw error if cluster type is not one of the 3 supported types

0.1PP.9
++++++++++++++++++

* Rename azuremonitor-containers extension type to microsoft.azuremonitor.containers
* Move CLI errors to non-deprecated error types
* Remove support for update

0.1PP.10
++++++++++++++++++

* Add azuremonitor-containers back with alternative microsoft.azuremonitor.containers

0.1PP.11
0.1.3
++++++++++++++++++

* Add shorter aliases for long parameter names
* Customization for microsoft.openservicemesh

0.1PP.12
0.1.2
++++++++++++++++++

* Remove support for azuremonitor-containers extension type naming
* Add support for Arc Appliance cluster type

0.1PP.13
0.1.1
++++++++++++++++++
* Add support for microsoft-azure-defender extension type

* Move CLI errors to non-deprecated error types
* Remove support for update

0.1PP.14
0.1.0
++++++++++++++++++

* Update help text, group CLI arguments
* Initial release.
6 changes: 3 additions & 3 deletions src/k8s-extension/azext_k8s_extension/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@


def cf_k8s_extension(cli_ctx, *_):
from azext_k8s_extension.vendored_sdks import K8sExtensionClient
return get_mgmt_service_client(cli_ctx, K8sExtensionClient)
from azext_k8s_extension.vendored_sdks import SourceControlConfigurationClient
return get_mgmt_service_client(cli_ctx, SourceControlConfigurationClient)


def cf_k8s_extension_operation(cli_ctx, _):
return cf_k8s_extension(cli_ctx).k8s_extensions
return cf_k8s_extension(cli_ctx).extensions


def cf_resource_groups(cli_ctx, subscription_id=None):
Expand Down
2 changes: 1 addition & 1 deletion src/k8s-extension/azext_k8s_extension/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# --------------------------------------------------------------------------------------------

EXTENSION_NAME = 'k8s-extension'
VERSION = "0.1.1"
VERSION = "0.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from knack.log import get_logger

from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceForCreate
from azext_k8s_extension.vendored_sdks.models import ExtensionInstance
from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceUpdate
from azext_k8s_extension.vendored_sdks.models import ScopeCluster
from azext_k8s_extension.vendored_sdks.models import Scope
Expand All @@ -25,7 +25,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
configuration_settings_file, configuration_protected_settings_file):

"""ExtensionType 'microsoft.azuredefender.kubernetes' specific validations & defaults for Create
Must create and return a valid 'ExtensionInstanceForCreate' object.
Must create and return a valid 'ExtensionInstance' object.

"""
# NOTE-1: Replace default scope creation with your customization!
Expand All @@ -46,9 +46,9 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
_get_container_insights_settings(cmd, resource_group_name, cluster_name, configuration_settings,
configuration_protected_settings, is_ci_extension_type)

# NOTE-2: Return a valid ExtensionInstanceForCreate object, Instance name and flag for Identity
# NOTE-2: Return a valid ExtensionInstance object, Instance name and flag for Identity
create_identity = True
extension_instance = ExtensionInstanceForCreate(
extension_instance = ExtensionInstance(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from msrestazure.azure_exceptions import CloudError
from msrestazure.tools import parse_resource_id, is_valid_resource_id

from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceForCreate
from azext_k8s_extension.vendored_sdks.models import ExtensionInstance
from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceUpdate
from azext_k8s_extension.vendored_sdks.models import ScopeCluster
from azext_k8s_extension.vendored_sdks.models import Scope
Expand All @@ -37,7 +37,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
configuration_settings_file, configuration_protected_settings_file):

"""ExtensionType 'microsoft.azuremonitor.containers' specific validations & defaults for Create
Must create and return a valid 'ExtensionInstanceForCreate' object.
Must create and return a valid 'ExtensionInstance' object.

"""
# NOTE-1: Replace default scope creation with your customization!
Expand All @@ -58,9 +58,9 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
_get_container_insights_settings(cmd, resource_group_name, cluster_name, configuration_settings,
configuration_protected_settings, is_ci_extension_type)

# NOTE-2: Return a valid ExtensionInstanceForCreate object, Instance name and flag for Identity
# NOTE-2: Return a valid ExtensionInstance object, Instance name and flag for Identity
create_identity = True
extension_instance = ExtensionInstanceForCreate(
extension_instance = ExtensionInstance(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# pylint: disable=unused-argument

from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceForCreate
from azext_k8s_extension.vendored_sdks.models import ExtensionInstance
from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceUpdate
from azext_k8s_extension.vendored_sdks.models import ScopeCluster
from azext_k8s_extension.vendored_sdks.models import ScopeNamespace
Expand All @@ -21,7 +21,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
configuration_settings_file, configuration_protected_settings_file):

"""Default validations & defaults for Create
Must create and return a valid 'ExtensionInstanceForCreate' object.
Must create and return a valid 'ExtensionInstance' object.

"""
ext_scope = None
Expand All @@ -37,7 +37,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
release_train = 'stable'

create_identity = False
extension_instance = ExtensionInstanceForCreate(
extension_instance = ExtensionInstance(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------

from abc import ABC, abstractmethod
from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceForCreate
from azext_k8s_extension.vendored_sdks.models import ExtensionInstance
from azext_k8s_extension.vendored_sdks.models import ExtensionInstanceUpdate


Expand All @@ -14,10 +14,10 @@ def Create(self, cmd, client, resource_group_name: str, cluster_name: str, name:
extension_type: str, scope: str, auto_upgrade_minor_version: bool, release_train: str, version: str,
target_namespace: str, release_namespace: str, configuration_settings: dict,
configuration_protected_settings: dict, configuration_settings_file: str,
configuration_protected_settings_file: str) -> ExtensionInstanceForCreate:
configuration_protected_settings_file: str) -> ExtensionInstance:
pass

@abstractmethod
def Update(self, extension: ExtensionInstanceForCreate, auto_upgrade_minor_version: bool,
def Update(self, extension: ExtensionInstance, auto_upgrade_minor_version: bool,
release_train: str, version: str) -> ExtensionInstanceUpdate:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# regenerated.
# --------------------------------------------------------------------------

from ._configuration import K8sExtensionClientConfiguration
from ._k8s_extension_client import K8sExtensionClient
__all__ = ['K8sExtensionClient', 'K8sExtensionClientConfiguration']
from ._configuration import SourceControlConfigurationClientConfiguration
from ._source_control_configuration_client import SourceControlConfigurationClient
__all__ = ['SourceControlConfigurationClient', 'SourceControlConfigurationClientConfiguration']

from .version import VERSION

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from .version import VERSION


class K8sExtensionClientConfiguration(AzureConfiguration):
"""Configuration for K8sExtensionClient
class SourceControlConfigurationClientConfiguration(AzureConfiguration):
"""Configuration for SourceControlConfigurationClient
Note that all parameters used to create this instance are saved as instance
attributes.

Expand All @@ -37,7 +37,7 @@ def __init__(
if not base_url:
base_url = 'https://management.azure.com'

super(K8sExtensionClientConfiguration, self).__init__(base_url)
super(SourceControlConfigurationClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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 msrest.service_client import SDKClient
from msrest import Serializer, Deserializer

from ._configuration import SourceControlConfigurationClientConfiguration
from .operations import SourceControlConfigurationsOperations
from .operations import Operations
from .operations import ExtensionsOperations
from . import models


class SourceControlConfigurationClient(SDKClient):
"""KubernetesConfiguration Client

:ivar config: Configuration for client.
:vartype config: SourceControlConfigurationClientConfiguration

:ivar source_control_configurations: SourceControlConfigurations operations
:vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.operations.SourceControlConfigurationsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.kubernetesconfiguration.operations.Operations
:ivar extensions: Extensions operations
:vartype extensions: azure.mgmt.kubernetesconfiguration.operations.ExtensionsOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
: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
"""

def __init__(
self, credentials, subscription_id, base_url=None):

self.config = SourceControlConfigurationClientConfiguration(credentials, subscription_id, base_url)
super(SourceControlConfigurationClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2020-07-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

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)
Loading