Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
Closed
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
8 changes: 8 additions & 0 deletions src/storagecache/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/storagecache/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'storagecache' Extension
==========================================

This package is for the 'storagecache' extension.
i.e. 'az storagecache'
32 changes: 32 additions & 0 deletions src/storagecache/azext_storagecache/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# --------------------------------------------------------------------------------------------
# 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 import AzCommandsLoader

from .generated._help import helps # pylint: disable=unused-import


class StorageCacheManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .generated._client_factory import cf_storagecache
storagecache_custom = CliCommandType(
operations_tmpl='azext_storagecache.custom#{}',
client_factory=cf_storagecache)
super(StorageCacheManagementClientCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=storagecache_custom)

def load_command_table(self, args):
from .generated.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from .generated._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = StorageCacheManagementClientCommandsLoader
13 changes: 13 additions & 0 deletions src/storagecache/azext_storagecache/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
4 changes: 4 additions & 0 deletions src/storagecache/azext_storagecache/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.0.67"
}
13 changes: 13 additions & 0 deletions src/storagecache/azext_storagecache/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.commands import * # noqa: F403
try:
from .manual.commands import * # noqa: F403
except ImportError:
pass
13 changes: 13 additions & 0 deletions src/storagecache/azext_storagecache/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
26 changes: 26 additions & 0 deletions src/storagecache/azext_storagecache/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def cf_storagecache(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.storagecache import StorageCacheManagementClient
return get_mgmt_service_client(cli_ctx, StorageCacheManagementClient)


def cf_sku(cli_ctx, *_):
return cf_storagecache(cli_ctx).sku


def cf_usage_model(cli_ctx, *_):
return cf_storagecache(cli_ctx).usage_model


def cf_cach(cli_ctx, *_):
return cf_storagecache(cli_ctx).cach


def cf_storage_target(cli_ctx, *_):
return cf_storagecache(cli_ctx).storage_target
178 changes: 178 additions & 0 deletions src/storagecache/azext_storagecache/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# 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.
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=line-too-long
from knack.help_files import helps # pylint: disable=unused-import


helps['storagecache sku'] = """
type: group
short-summary: storagecache sku
"""

helps['storagecache sku list'] = """
type: command
short-summary: Get the list of StorageCache.Cache SKUs available to this subscription.
examples:
- name: Skus_List
text: |-
az storagecache sku list
"""

helps['storagecache usage-model'] = """
type: group
short-summary: storagecache usage-model
"""

helps['storagecache usage-model list'] = """
type: command
short-summary: Get the list of Cache Usage Models available to this subscription.
examples:
- name: UsageModels_List
text: |-
az storagecache usage-model list
"""

helps['storagecache cach'] = """
type: group
short-summary: storagecache cach
"""

helps['storagecache cach list'] = """
type: command
short-summary: Returns all Caches the user has access to under a subscription.
examples:
- name: Caches_ListByResourceGroup
text: |-
az storagecache cach list --resource-group "scgroup"
"""

helps['storagecache cach show'] = """
type: command
short-summary: Returns a Cache.
examples:
- name: Caches_Get
text: |-
az storagecache cach show --cache-name "sc1" --resource-group "scgroup"
"""

helps['storagecache cach create'] = """
type: command
short-summary: Create or update a Cache.
examples:
- name: Caches_CreateOrUpdate
text: |-
az storagecache cach create --cache-name "sc1" --resource-group "scgroup"
"""

helps['storagecache cach update'] = """
type: command
short-summary: Update a Cache instance.
examples:
- name: Caches_Update
text: |-
az storagecache cach update --cache-name "sc1" --resource-group "scgroup"
"""

helps['storagecache cach delete'] = """
type: command
short-summary: Schedules a Cache for deletion.
examples:
- name: Caches_Delete
text: |-
az storagecache cach delete --cache-name "sc" --resource-group "scgroup"
"""

helps['storagecache cach flush'] = """
type: command
short-summary: Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete.
examples:
- name: Caches_Flush
text: |-
az storagecache cach flush --cache-name "sc" --resource-group "scgroup"
"""

helps['storagecache cach start'] = """
type: command
short-summary: Tells a Stopped state Cache to transition to Active state.
examples:
- name: Caches_Start
text: |-
az storagecache cach start --cache-name "sc" --resource-group "scgroup"
"""

helps['storagecache cach stop'] = """
type: command
short-summary: Tells an Active Cache to transition to Stopped state.
examples:
- name: Caches_Stop
text: |-
az storagecache cach stop --cache-name "sc" --resource-group "scgroup"
"""

helps['storagecache cach upgrade-firmware'] = """
type: command
short-summary: Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect.
examples:
- name: Caches_UpgradeFirmware
text: |-
az storagecache cach upgrade-firmware --cache-name "sc1" --resource-group "scgroup"
"""

helps['storagecache storage-target'] = """
type: group
short-summary: storagecache storage-target
"""

helps['storagecache storage-target list'] = """
type: command
short-summary: Returns a list of Storage Targets for the specified Cache.
examples:
- name: StorageTargets_List
text: |-
az storagecache storage-target list --cache-name "sc1" --resource-group "scgroup"
"""

helps['storagecache storage-target show'] = """
type: command
short-summary: Returns a Storage Target from a Cache.
examples:
- name: StorageTargets_Get
text: |-
az storagecache storage-target show --cache-name "sc1" --resource-group "scgroup" \\
--storage-target-name "st1"
"""

helps['storagecache storage-target create'] = """
type: command
short-summary: Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again.
examples:
- name: StorageTargets_CreateOrUpdate
text: |-
az storagecache storage-target create --cache-name "sc1" --resource-group "scgroup" \\
--storage-target-name "st1"
"""

helps['storagecache storage-target update'] = """
type: command
short-summary: Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again.
examples:
- name: StorageTargets_CreateOrUpdate
text: |-
az storagecache storage-target create --cache-name "sc1" --resource-group "scgroup" \\
--storage-target-name "st1"
"""

helps['storagecache storage-target delete'] = """
type: command
short-summary: Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted.
examples:
- name: StorageTargets_Delete
text: |-
az storagecache storage-target delete --cache-name "sc1" --resource-group "scgroup" \\
--storage-target-name "st1"
"""
89 changes: 89 additions & 0 deletions src/storagecache/azext_storagecache/generated/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from azure.cli.core.commands.parameters import (
tags_type,
resource_group_name_type,
get_location_type
)
from azext_storagecache.action import (
AddCache,
AddStoragetarget
)


def load_arguments(self, _):

with self.argument_context('storagecache sku list') as c:
pass

with self.argument_context('storagecache usage-model list') as c:
pass

with self.argument_context('storagecache cach list') as c:
c.argument('resource_group_name', resource_group_name_type)

with self.argument_context('storagecache cach show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache cach create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')
c.argument('cache', help='Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must match the existing values of those properties.', action=AddCache, nargs='+')

with self.argument_context('storagecache cach update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')
c.argument('cache', help='Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must match the existing values of those properties.', action=AddCache, nargs='+')

with self.argument_context('storagecache cach delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache cach flush') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache cach start') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache cach stop') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache cach upgrade-firmware') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache storage-target list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')

with self.argument_context('storagecache storage-target show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')
c.argument('storage_target_name', help='Name of Storage Target.')

with self.argument_context('storagecache storage-target create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')
c.argument('storage_target_name', help='Name of Storage Target.')
c.argument('storagetarget', help='Object containing the definition of a Storage Target.', action=AddStoragetarget, nargs='+')

with self.argument_context('storagecache storage-target update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')
c.argument('storage_target_name', help='Name of Storage Target.')
c.argument('storagetarget', help='Object containing the definition of a Storage Target.', action=AddStoragetarget, nargs='+')

with self.argument_context('storagecache storage-target delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cache_name', help='Name of Cache.')
c.argument('storage_target_name', help='Name of Storage Target.')
Loading