Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3ac5c36
storagemover
calvinhzy Jun 22, 2022
a8f69ab
add codeowner, arg name changes
calvinhzy Jun 23, 2022
aee9920
swagger update
calvinhzy Jun 30, 2022
a889391
Merge branch 'main' into storagemover
calvinhzy Jun 30, 2022
c4d2cc2
regenerate with 0.8.0
calvinhzy Jul 11, 2022
2b5f9ab
update swagger, 0.9.3
calvinhzy Aug 3, 2022
285d3c5
merge
calvinhzy Aug 4, 2022
c8b19c0
shorten arg
calvinhzy Aug 4, 2022
0392cad
service name
calvinhzy Aug 4, 2022
7172dea
storage-mover delete confirmation warning
calvinhzy Aug 4, 2022
b569d6e
storage-mover agent delete confirmation warning
calvinhzy Aug 4, 2022
221774d
add tests for storage-mover and storage-mover project
calvinhzy Aug 8, 2022
4301a69
add tests for storage-mover endpoint
calvinhzy Aug 10, 2022
5df3302
help for update endpoint
calvinhzy Aug 10, 2022
2007e4d
hide create agent
calvinhzy Aug 12, 2022
da2c063
merge and lint
calvinhzy Aug 12, 2022
95bcf1d
lint
calvinhzy Aug 12, 2022
bd98c05
agent delete renamed to be unregister
calvinhzy Aug 12, 2022
82dfd1a
add test for agent, not run yet
calvinhzy Aug 19, 2022
0ca6249
regen for new aazdev version
calvinhzy Jan 10, 2023
8113e4c
add examples to tested commands
calvinhzy Feb 7, 2023
6a3daea
change job-definition update to PATCH
calvinhzy Feb 9, 2023
6e9e795
finish job-definition/job-run tests with examples
calvinhzy Feb 10, 2023
b8256be
Merge remote-tracking branch 'upstream/main' into storagemover
calvinhzy Feb 10, 2023
08138e1
fix CI
calvinhzy Feb 10, 2023
8965032
add examples to readme
calvinhzy Feb 10, 2023
bdb4296
Merge remote-tracking branch 'upstream/main' into storagemover
calvinhzy Feb 20, 2023
4a9f92a
switch to 2023-03-01 api version
calvinhzy Feb 22, 2023
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
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,6 @@

/src/voice-service/ @jsntcy

/src/confcom/ @BryceDFisher @SethHollandsworth @hgarvison @stevendongatmsft
/src/confcom/ @BryceDFisher @SethHollandsworth @hgarvison @stevendongatmsft

/src/storage-mover/ @calvinhzy
5 changes: 5 additions & 0 deletions src/service_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,5 +708,10 @@
"Command": "az voice-service",
"AzureServiceName": "Azure VoiceServices",
"URL": ""
},
{
"Command": "az storage-mover",
"AzureServiceName": "Storage Mover",
"URL": "https://learn.microsoft.com/en-us/azure/storage-mover/"
}
]
8 changes: 8 additions & 0 deletions src/storage-mover/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

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

0.1.0
++++++
* Initial release.
36 changes: 36 additions & 0 deletions src/storage-mover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Azure CLI StorageMover Extension #
This is an extension to Azure CLI to manage StorageMover resources.

## How to use ##
### Create a top-level Storage Mover resource.
`az storage-mover create -g {rg} -n {mover_name} -l eastus2 --tags {{key1:value1}} --description ExampleDesc`

### Deploy and register an Agent resource, which references a hybrid compute machine that can run jobs.
#### Deploy Agent
https://learn.microsoft.com/en-us/azure/storage-mover/agent-deploy?tabs=xdmshell
#### Register Agent
https://learn.microsoft.com/en-us/azure/storage-mover/agent-register

### Create a Project resource, which is a logical grouping of related jobs.
`az storage-mover project create -g {rg} --storage-mover-name {mover_name} -n {project_name} --description ProjectDesc`

### Create an Endpoint resource for nfs, which represents the data transfer source.
`az storage-mover endpoint create-for-nfs -g {rg} --storage-mover-name {mover_name} -n {source_endpoint} --description srcendpointDesc --export exportfolder --nfs-version NFSv4 --host {vm_ip}`

### Create an Endpoint resource for storage container, which represents the data transfer destination.
`az storage-mover endpoint create-for-storage-container -g {rg} --storage-mover-name {mover_name} -n {target_endpoint} --container-name {target_container} --storage-account-id {account_id} --description tgtendpointDesc`

### Create a Job Definition resource, which contains configuration for a single unit of managed data transfer.
`az storage-mover job-definition create -g {rg} -n {job_definition} --project-name {project_name} --storage-mover-name {mover_name} --copy-mode Additive --source-name {source_endpoint} --target-name {target_endpoint} --agent-name {agent_name} --description JobDefinitionDescription --source-subpath path1 --target-subpath path2`

### Request an Agent to start a new instance of this Job Definition, generating a new Job Run resource.
`az storage-mover job-definition start-job -g {rg} --job-definition-name {job_definition} --project-name {project_name} --storage-mover-name {mover_name}`

### List all Job Runs in a Job Definition.
`az storage-mover job-run list -g {rg} --job-definition-name {job_definition} --project-name {project_name} --storage-mover-name {mover_name}`

### Request the Agent of any active instance of this Job Definition to stop.
`az storage-mover job-definition stop-job -g {rg} --job-definition-name {job_definition} --project-name {project_name} --storage-mover-name {mover_name}`

### Delete a Job Definition resource.
`az storage-mover job-definition delete -g {rg} -n {job_definition} --project-name {project_name} --storage-mover-name {mover_name}`
42 changes: 42 additions & 0 deletions src/storage-mover/azext_storage_mover/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_storage_mover._help import helps # pylint: disable=unused-import


class StorageMoverCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_storage_mover.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_storage_mover.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

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


COMMAND_LOADER_CLS = StorageMoverCommandsLoader
51 changes: 51 additions & 0 deletions src/storage-mover/azext_storage_mover/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import

helps['storage-mover endpoint create-for-storage-container'] = """
type: command
short-summary: Creates an Endpoint resource for storage blob container.
examples:
- name: endpoint create-for-storage-container
text: >
az storage-mover endpoint create-for-storage-container -g {rg} --storage-mover-name {mover_name} -n
{endpoint_container} --container-name {container_name} --storage-account-id {account_id} --description endpointDesc
"""

helps['storage-mover endpoint create-for-nfs'] = """
type: command
short-summary: Creates an Endpoint resource for nfs.
examples:
- name: endpoint create-for-nfs
text: >
az storage-mover endpoint create-for-nfs -g {rg} --storage-mover-name {mover_name} -n {endpoint_nfs}
--description endpointDesc --export exportfolder --nfs-version NFSv4 --host {vm_ip}
"""

helps['storage-mover endpoint update-for-storage-container'] = """
type: command
short-summary: Updates an Endpoint resource for storage blob container.
examples:
- name: endpoint update-for-storage-container
text: >
az storage-mover endpoint update-for-storage-container -g {rg} --storage-mover-name {mover_name} -n
{endpoint_container} --description endpointDescUpdate --container-name {container_name} --storage-account-id {account_id}
"""

helps['storage-mover endpoint update-for-nfs'] = """
type: command
short-summary: Updates an Endpoint resource for nfs.
examples:
- name: endpoint update-for-nfs
text: >
az storage-mover endpoint update-for-nfs -g {rg} --storage-mover-name {mover_name} -n {endpoint_nfs}
--description endpointDescUpdate --export exportfolder --nfs-version NFSv4 --host {vm_ip}
"""
38 changes: 38 additions & 0 deletions src/storage-mover/azext_storage_mover/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=too-many-statements
from azure.cli.core.commands.parameters import (get_enum_type)


def load_arguments(self, _): # pylint: disable=unused-argument

for command in ['create-for-storage-container', 'create-for-nfs', 'update-for-storage-container', 'update-for-nfs']:
with self.argument_context('storage-mover endpoint ' + command) as c:
c.argument('endpoint_name', options_list=('--endpoint-name', '--name', '-n'), required=True,
help='The name of the endpoint resource.')
c.argument('resource_group', options_list=('--resource-group', '-g'), required=True,
help='Name of resource group. You can configure the default group using '
'`az configure --defaults group=<name>`.')
c.argument('storage_mover_name', options_list=('--storage-mover-name'), required=True,
help='The name of the Storage Mover resource.')
c.argument('description', help='A description for the Endpoint.')

for command in ['create-for-storage-container', 'update-for-storage-container']:
with self.argument_context('storage-mover endpoint ' + command) as c:
c.argument('blob_container_name', options_list=('--container-name'), required=True,
help='The name of the Storage blob container that is the target destination.')
c.argument('storage_account_resource_id', options_list=('--storage-account-id'), required=True,
help=' The Azure Resource ID of the storage account that is the target destination.')

for command in ['create-for-nfs', 'update-for-nfs']:
with self.argument_context('storage-mover endpoint ' + command) as c:
c.argument('export', required=True, help='The directory being exported from the server.')
c.argument('host', required=True, help='The host name or IP address of the server exporting the file system.')
c.argument('nfs_version', arg_type=get_enum_type(['NFSauto', 'NFSv3', 'NFSv4']),
help='The NFS protocol version.')
6 changes: 6 additions & 0 deletions src/storage-mover/azext_storage_mover/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"storage-mover",
)
class __CMDGroup(AAZCommandGroup):
"""Manage top-level Storage Mover resource.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
from ._wait import *
Loading