Skip to content

Commit

Permalink
Merge branch 'NanThi-ApiVer-2021-05-01-preview' into k8s-extension/pu…
Browse files Browse the repository at this point in the history
…blic
  • Loading branch information
anagg929 authored Jul 9, 2021
2 parents de426d4 + 0076dcf commit 70e658d
Show file tree
Hide file tree
Showing 21 changed files with 26,167 additions and 807 deletions.
24,311 changes: 24,311 additions & 0 deletions get-pip.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from azure.cli.core.azclierror import ResourceNotFoundError, MutuallyExclusiveArgumentError, \
InvalidArgumentValueError, CommandNotFoundError, RequiredArgumentMissingError
from azure.cli.core.commands.client_factory import get_subscription_id
from .vendored_sdks.models import ConfigurationIdentity, ErrorResponseException, Scope
from .vendored_sdks.models import Identity, ErrorResponseException, Scope
from ._validators import validate_cc_registration

from .partner_extensions.ContainerInsights import ContainerInsights
Expand Down Expand Up @@ -183,7 +183,7 @@ def update_k8s_extension(client, resource_group_name, cluster_type, cluster_name

# __validate_version_and_auto_upgrade(version, auto_upgrade_minor_version)

# upd_extension = ExtensionInstanceUpdate(auto_upgrade_minor_version=auto_upgrade_minor_version,
# upd_extension = Extension(auto_upgrade_minor_version=auto_upgrade_minor_version,
# release_train=release_train, version=version)

# return client.update(resource_group_name, cluster_rp, cluster_type, cluster_name, name, upd_extension)
Expand Down Expand Up @@ -238,7 +238,7 @@ def __create_identity(cmd, resource_group_name, cluster_name, cluster_type, clus
raise ex
identity_type = "SystemAssigned"

return ConfigurationIdentity(type=identity_type), location
return Identity(type=identity_type), location


def __get_cluster_rp(cluster_type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

from knack.log import get_logger

from ..vendored_sdks.models import ExtensionInstance
from ..vendored_sdks.models import ExtensionInstanceUpdate
from ..vendored_sdks.models import Extension
from ..vendored_sdks.models import ScopeCluster
from ..vendored_sdks.models import Scope

Expand All @@ -25,7 +24,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 'ExtensionInstance' object.
Must create and return a valid 'Extension' object.
"""
# NOTE-1: Replace default scope creation with your customization!
Expand All @@ -47,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 ExtensionInstance object, Instance name and flag for Identity
# NOTE-2: Return a valid Extension object, Instance name and flag for Identity
create_identity = True
extension_instance = ExtensionInstance(
extension_instance = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand All @@ -62,10 +61,10 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
"""ExtensionType 'microsoft.azuredefender.kubernetes' specific validations & defaults for Update
Must create and return a valid 'ExtensionInstanceUpdate' object.
Must create and return a valid 'Extension' object.
"""
return ExtensionInstanceUpdate(
return Extension(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
from .._client_factory import cf_resources
from .PartnerExtensionModel import PartnerExtensionModel
from ..vendored_sdks.models import (
ExtensionInstance,
ExtensionInstanceUpdate,
Extension,
Scope,
ScopeCluster
)
Expand Down Expand Up @@ -142,7 +141,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
release_train = 'stable'

create_identity = True
extension_instance = ExtensionInstance(
extension_instance = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand All @@ -156,7 +155,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
return extension_instance, name, create_identity

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
return ExtensionInstanceUpdate(
return Extension(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

# pylint: disable=unused-argument

from ..vendored_sdks.models import ExtensionInstance
from ..vendored_sdks.models import ExtensionInstanceUpdate
from ..vendored_sdks.models import Extension
from ..vendored_sdks.models import ScopeCluster
from ..vendored_sdks.models import ScopeNamespace
from ..vendored_sdks.models import Scope
Expand All @@ -21,7 +20,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 'ExtensionInstance' object.
Must create and return a valid 'Extension' object.
"""
ext_scope = None
Expand All @@ -34,7 +33,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
ext_scope = Scope(namespace=scope_namespace, cluster=None)

create_identity = True
extension_instance = ExtensionInstance(
extension_instance = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand All @@ -47,10 +46,10 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
"""Default validations & defaults for Update
Must create and return a valid 'ExtensionInstanceUpdate' object.
Must create and return a valid 'Extension' object.
"""
return ExtensionInstanceUpdate(
return Extension(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
from azure.cli.core.util import sdk_no_wait
from msrestazure.tools import parse_resource_id, is_valid_resource_id

from ..vendored_sdks.models import ExtensionInstance
from ..vendored_sdks.models import ExtensionInstanceUpdate
from ..vendored_sdks.models import Extension
from ..vendored_sdks.models import ScopeCluster
from ..vendored_sdks.models import Scope

Expand All @@ -36,7 +35,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 'ExtensionInstance' object.
Must create and return a valid 'Extension' object.
"""
# NOTE-1: Replace default scope creation with your customization!
Expand All @@ -58,9 +57,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 ExtensionInstance object, Instance name and flag for Identity
# NOTE-2: Return a valid Extension object, Instance name and flag for Identity
create_identity = True
extension_instance = ExtensionInstance(
extension_instance = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand All @@ -73,10 +72,10 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
"""ExtensionType 'microsoft.azuremonitor.containers' specific validations & defaults for Update
Must create and return a valid 'ExtensionInstanceUpdate' object.
Must create and return a valid 'Extension' object.
"""
return ExtensionInstanceUpdate(
return Extension(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

# pylint: disable=unused-argument

from ..vendored_sdks.models import ExtensionInstance
from ..vendored_sdks.models import ExtensionInstanceUpdate
from ..vendored_sdks.models import Extension
from ..vendored_sdks.models import ScopeCluster
from ..vendored_sdks.models import ScopeNamespace
from ..vendored_sdks.models import Scope
Expand All @@ -21,7 +20,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 'ExtensionInstance' object.
Must create and return a valid 'Extension' object.
"""
ext_scope = None
Expand All @@ -34,7 +33,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
ext_scope = Scope(namespace=scope_namespace, cluster=None)

create_identity = False
extension_instance = ExtensionInstance(
extension_instance = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand All @@ -47,10 +46,10 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
"""Default validations & defaults for Update
Must create and return a valid 'ExtensionInstanceUpdate' object.
Must create and return a valid 'Extension' object.
"""
return ExtensionInstanceUpdate(
return Extension(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
from .PartnerExtensionModel import PartnerExtensionModel

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

"""ExtensionType 'microsoft.openservicemesh' specific validations & defaults for Create
Must create and return a valid 'ExtensionInstance' object.
Must create and return a valid 'Extension' object.
"""
# NOTE-1: Replace default scope creation with your customization, if required
Expand All @@ -64,12 +63,12 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
auto_upgrade_minor_version = False
logger.warning("Setting auto-upgrade-minor-version to False since release-train is '%s'", release_train)

# NOTE-2: Return a valid ExtensionInstance object, Instance name and flag for Identity
# NOTE-2: Return a valid Extension object, Instance name and flag for Identity
create_identity = False

# _validate_tested_distro(cmd, resource_group_name, cluster_name, version)

extension_instance = ExtensionInstance(
extension_instance = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
Expand All @@ -84,7 +83,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
"""ExtensionType 'microsoft.openservicemesh' specific validations & defaults for Update
Must create and return a valid 'ExtensionInstanceUpdate' object.
Must create and return a valid 'Extension' object.
"""
# auto-upgrade-minor-version MUST be set to False if release_train is staging or pilot
Expand All @@ -95,7 +94,7 @@ def Update(self, extension, auto_upgrade_minor_version, release_train, version):
version = None
logger.warning("Setting auto-upgrade-minor-version to False since release-train is '%s'", release_train)

return ExtensionInstanceUpdate(
return Extension(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# --------------------------------------------------------------------------------------------

from abc import ABC, abstractmethod
from ..vendored_sdks.models import ExtensionInstance
from ..vendored_sdks.models import ExtensionInstanceUpdate
from ..vendored_sdks.models import Extension


class PartnerExtensionModel(ABC):
Expand All @@ -14,12 +13,12 @@ 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) -> ExtensionInstance:
configuration_protected_settings_file: str) -> Extension:
pass

@abstractmethod
def Update(self, extension: ExtensionInstance, auto_upgrade_minor_version: bool,
release_train: str, version: str) -> ExtensionInstanceUpdate:
def Update(self, extension: Extension, auto_upgrade_minor_version: bool,
release_train: str, version: str) -> Extension:
pass

@abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class SourceControlConfigurationClientConfiguration(AzureConfiguration):
: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)
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
from msrest import Serializer, Deserializer

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


Expand All @@ -25,18 +26,19 @@ class SourceControlConfigurationClient(SDKClient):
:ivar config: Configuration for client.
:vartype config: SourceControlConfigurationClientConfiguration
:ivar extensions: Extensions operations
:vartype extensions: azure.mgmt.kubernetesconfiguration.operations.ExtensionsOperations
:ivar operation_status: OperationStatus operations
:vartype operation_status: azure.mgmt.kubernetesconfiguration.operations.OperationStatusOperations
: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)
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand All @@ -48,13 +50,15 @@ def __init__(
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.api_version = '2021-05-01-preview'
self._serialize = Serializer(client_models)
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.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

0 comments on commit 70e658d

Please sign in to comment.