コード例 #1
0
 def test_register_resource_type_bad_rt_attempted_override(self):
     test_profile = {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles.API_PROFILES', test_profile):
         with self.assertRaises(TypeError):
             register_resource_type('doesnotexist',
                                    ResourceType.MGMT_STORAGE,
                                    '2020-12-12-preview')
コード例 #2
0
 def test_register_resource_type_bad_profile(self):
     test_profile = {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles.API_PROFILES', test_profile):
         custom_rt = CustomResourceType('mysdkpath', 'myClient')
         with self.assertRaises(ValueError):
             register_resource_type('doesnotexist', custom_rt,
                                    '2020-12-12-preview')
コード例 #3
0
 def test_register_resource_type_valid(self):
     test_profile = {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles.API_PROFILES', test_profile):
         custom_rt = CustomResourceType('mysdkpath', 'myClient')
         register_resource_type('latest', custom_rt, '2020-12-12-preview')
         from azure.cli.core.profiles import API_PROFILES
         self.assertDictEqual(API_PROFILES, {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10',
                                                        custom_rt: '2020-12-12-preview'}})
コード例 #4
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        register_resource_type('latest', CUSTOM_MGMT_AKS_PREVIEW, '2020-04-01')

        acs_custom = CliCommandType(operations_tmpl='azext_aks_preview.custom#{}')
        super(ContainerServiceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                             custom_command_type=acs_custom,
                                                             resource_type=CUSTOM_MGMT_AKS_PREVIEW)
コード例 #5
0
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     from .profiles import CUSTOM_ER
     register_resource_type('latest', CUSTOM_ER, '2018-08-01')
     super(ExpressRouteCommandsLoader, self).__init__(
         cli_ctx=cli_ctx,
         custom_command_type=CliCommandType(
             operations_tmpl='azext_express_route.custom#{}'),
         resource_type=CUSTOM_ER)
コード例 #6
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        register_resource_type('latest', CUSTOM_MGMT_APPSERVICE, '2019-08-01')

        appservice_kube_custom = CliCommandType(
            operations_tmpl='azext_appservice_kube.custom#{}')
        super(AppserviceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                       custom_command_type=appservice_kube_custom,
                                                       resource_type=CUSTOM_MGMT_APPSERVICE)
コード例 #7
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        register_resource_type('latest', CUSTOM_MGMT_AKS_PREVIEW, '2019-04-01')

        acs_custom = CliCommandType(operations_tmpl='azext_aks_preview.custom#{}')
        super(ContainerServiceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                             custom_command_type=acs_custom,
                                                             resource_type=CUSTOM_MGMT_AKS_PREVIEW,
                                                             min_profile='2017-03-10-profile')
コード例 #8
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        from .profiles import CUSTOM_FIREWALL
        register_resource_type('latest', CUSTOM_FIREWALL, '2021-08-01')

        super().__init__(cli_ctx=cli_ctx,
                         custom_command_type=CliCommandType(
                             operations_tmpl='azext_firewall.custom#{}'),
                         resource_type=CUSTOM_FIREWALL)
コード例 #9
0
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     from .profiles import CUSTOM_ER_CC
     register_resource_type('latest', CUSTOM_ER_CC, '2018-04-01')
     super(ExpressRouteCrossConnectionCommandsLoader, self).__init__(
         cli_ctx=cli_ctx,
         custom_command_type=CliCommandType(operations_tmpl='azext_expressroutecrossconnection.custom#{}'),
         resource_type=CUSTOM_ER_CC
     )
コード例 #10
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType

        register_resource_type('latest', CUSTOM_MGMT_STORAGE_ORS, '2019-06-01')
        storage_custom = CliCommandType(operations_tmpl='azext_storage_ors_preview.custom#{}')

        super(StorageCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                    resource_type=CUSTOM_MGMT_STORAGE_ORS,
                                                    custom_command_type=storage_custom)
コード例 #11
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        from .profiles import CUSTOM_VWAN
        register_resource_type('latest', CUSTOM_VWAN, '2018-08-01')

        super(VirtualWanCommandsLoader,
              self).__init__(cli_ctx=cli_ctx,
                             custom_command_type=CliCommandType(
                                 operations_tmpl='azext_vwan.custom#{}'),
                             resource_type=CUSTOM_VWAN)
コード例 #12
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        from .profiles import CUSTOM_FIREWALL
        register_resource_type('latest', CUSTOM_FIREWALL, '2018-08-01')

        super(AzureFirewallCommandsLoader, self).__init__(
            cli_ctx=cli_ctx,
            custom_command_type=CliCommandType(operations_tmpl='azext_firewall.custom#{}'),
            resource_type=CUSTOM_FIREWALL
        )
コード例 #13
0
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     register_resource_type('latest', CUSTOM_DATA_STORAGE_BLOB, '2020-02-10')
     register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-01-01')
     storage_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.storage.custom#{}')
     super(StorageCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                 resource_type=CUSTOM_DATA_STORAGE_BLOB,
                                                 custom_command_type=storage_custom,
                                                 command_group_cls=StorageCommandGroup,
                                                 argument_context_cls=StorageArgumentContext)
コード例 #14
0
ファイル: __init__.py プロジェクト: wurp/azure-cli-extensions
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        from .profiles import CUSTOM_FIREWALL, CUSTOM_FIREWALL_POLICY
        register_resource_type('latest', CUSTOM_FIREWALL, '2019-09-01')
        register_resource_type('latest', CUSTOM_FIREWALL_POLICY, '2019-07-01')

        super(AzureFirewallCommandsLoader,
              self).__init__(cli_ctx=cli_ctx,
                             custom_command_type=CliCommandType(
                                 operations_tmpl='azext_firewall.custom#{}'),
                             resource_type=CUSTOM_FIREWALL)
コード例 #15
0
 def test_register_resource_type_valid(self):
     test_profile = {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles.API_PROFILES', test_profile):
         custom_rt = CustomResourceType('mysdkpath', 'myClient')
         register_resource_type('latest', custom_rt, '2020-12-12-preview')
         from azure.cli.core.profiles import API_PROFILES
         self.assertDictEqual(
             API_PROFILES, {
                 'latest': {
                     ResourceType.MGMT_STORAGE: '2020-10-10',
                     custom_rt: '2020-12-12-preview'
                 }
             })
コード例 #16
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType

        register_resource_type('latest', CUSTOM_DATA_STORAGE, '2017-11-09')
        storage_custom = CliCommandType(
            operations_tmpl='azext_storage_preview.custom#{}')

        super(StorageCommandsLoader,
              self).__init__(cli_ctx=cli_ctx,
                             resource_type=CUSTOM_DATA_STORAGE,
                             custom_command_type=storage_custom,
                             command_group_cls=StorageCommandGroup,
                             argument_context_cls=StorageArgumentContext)
コード例 #17
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        from .profiles import CUSTOM_NW_CONNECTION_MONITOR

        register_resource_type('latest', CUSTOM_NW_CONNECTION_MONITOR, '2019-11-01')

        nw_connection_monitor = CliCommandType(
            operations_tmpl='azext_connection_monitor_preview.custom#{}',
            client_factory=cf_nw_connection_monitor
        )

        super(NWConnectionMonitorCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                                custom_command_type=nw_connection_monitor,
                                                                resource_type=CUSTOM_NW_CONNECTION_MONITOR)
コード例 #18
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        from ._client_factory import cf_ip_groups
        from .profiles import CUSTOM_IP_GROUPS

        register_resource_type('latest', CUSTOM_IP_GROUPS, '2019-09-01')

        ip_groups_custom = CliCommandType(
            operations_tmpl='azext_ip_group.custom#{}',
            client_factory=cf_ip_groups)

        super(IpGroupsCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                     custom_command_type=ip_groups_custom,
                                                     resource_type=CUSTOM_IP_GROUPS)
コード例 #19
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        register_resource_type(
            "latest",
            CUSTOM_MGMT_AKS_PREVIEW,
            SDKProfile("2021-05-01", {"container_services": "2017-07-01"}),
        )

        acs_custom = CliCommandType(
            operations_tmpl='azext_aks_preview.custom#{}')
        super(ContainerServiceCommandsLoader,
              self).__init__(cli_ctx=cli_ctx,
                             custom_command_type=acs_custom,
                             resource_type=CUSTOM_MGMT_AKS_PREVIEW)
コード例 #20
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType

        register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')
        register_resource_type('latest', CUSTOM_DATA_STORAGE_ADLS, '2019-02-02-preview')
        register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-08-01')
        register_resource_type('latest', CUSTOM_DATA_STORAGE_FILESHARE, '2020-02-10')
        register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE, '2020-06-12')

        storage_custom = CliCommandType(operations_tmpl='azext_storage_preview.custom#{}')

        super(StorageCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                    resource_type=CUSTOM_DATA_STORAGE,
                                                    custom_command_type=storage_custom,
                                                    command_group_cls=StorageCommandGroup,
                                                    argument_context_cls=StorageArgumentContext)
コード例 #21
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType

        register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')
        register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2018-07-01')
        register_resource_type('latest', CUSTOM_MGMT_PREVIEW_STORAGE, '2018-03-01-preview')
        storage_custom = CliCommandType(operations_tmpl='azext_storage_preview.custom#{}')

        super(StorageCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                    min_profile='2017-03-10-profile',
                                                    resource_type=CUSTOM_DATA_STORAGE,
                                                    custom_command_type=storage_custom,
                                                    command_group_cls=StorageCommandGroup,
                                                    argument_context_cls=StorageArgumentContext)
コード例 #22
0
    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType

        register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')
        register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2018-07-01')
        register_resource_type('latest', CUSTOM_MGMT_PREVIEW_STORAGE,
                               '2018-03-01-preview')
        storage_custom = CliCommandType(
            operations_tmpl='azext_storage_preview.custom#{}')

        super(StorageCommandsLoader,
              self).__init__(cli_ctx=cli_ctx,
                             min_profile='2017-03-10-profile',
                             resource_type=CUSTOM_DATA_STORAGE,
                             custom_command_type=storage_custom,
                             command_group_cls=StorageCommandGroup,
                             argument_context_cls=StorageArgumentContext)
コード例 #23
0
 def test_register_resource_type_bad_profile(self):
     test_profile = {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles.API_PROFILES', test_profile):
         custom_rt = CustomResourceType('mysdkpath', 'myClient')
         with self.assertRaises(ValueError):
             register_resource_type('doesnotexist', custom_rt, '2020-12-12-preview')
コード例 #24
0
 def __init__(self, ctx):
     self.ctx = ctx
     register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')
コード例 #25
0
 def setUp(self):
     self.cli = MockCLI()
     register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2018-07-01')
コード例 #26
0
 def test_register_resource_type_bad_rt_attempted_override(self):
     test_profile = {'latest': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles.API_PROFILES', test_profile):
         with self.assertRaises(TypeError):
             register_resource_type('doesnotexist', ResourceType.MGMT_STORAGE, '2020-12-12-preview')
コード例 #27
0
def register_aks_preview_resource_type():
    register_resource_type(
        "latest",
        CUSTOM_MGMT_AKS_PREVIEW,
        SDKProfile("2021-09-01", {"container_services": "2017-07-01"}),
    )
コード例 #28
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_PREVIEW_STORAGE

register_resource_type('latest', CUSTOM_MGMT_PREVIEW_STORAGE,
                       '2020-08-01-preview')
コード例 #29
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_STORAGE
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2018-02-01')
コード例 #30
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_STORAGE
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2018-03-01-preview')
コード例 #31
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from azext_firewall.profiles import CUSTOM_FIREWALL
register_resource_type('latest', CUSTOM_FIREWALL, '2021-08-01')
コード例 #32
0
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------\
from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_STORAGE_ORS

register_resource_type('latest', CUSTOM_MGMT_STORAGE_ORS, '2019-06-01')
コード例 #33
0
 def setUp(self):
     self.cli = MockCLI()
     register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2018-07-01')
コード例 #34
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_STORAGE, CUSTOM_DATA_STORAGE_FILEDATALAKE

register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-08-01')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE,
                       '2020-06-12')
コード例 #35
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_PREVIEW_STORAGE, CUSTOM_DATA_STORAGE_FILEDATALAKE
register_resource_type('latest', CUSTOM_MGMT_PREVIEW_STORAGE,
                       '2020-08-01-preview')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE,
                       '2020-06-12')
コード例 #36
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.profiles import register_resource_type
from azext_firewall.profiles import CUSTOM_FIREWALL
register_resource_type('latest', CUSTOM_FIREWALL, '2018-08-01')
コード例 #37
0
 def __init__(self, ctx):
     self.ctx = ctx
     register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')