Skip to content
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
5 changes: 5 additions & 0 deletions src/storagesync/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

0.1.2
++++++
* Migrate to track2 SDK

0.1.1
++++++
* GA.
Expand Down
2 changes: 1 addition & 1 deletion src/storagesync/azext_storagesync/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def cf_storagesync(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .vendored_sdks.storagesync import StorageSyncManagementClient
from .vendored_sdks.storagesync import MicrosoftStorageSync as StorageSyncManagementClient
return get_mgmt_service_client(cli_ctx, StorageSyncManagementClient)


Expand Down
15 changes: 8 additions & 7 deletions src/storagesync/azext_storagesync/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def create_storagesync_sync_group(client,
resource_group_name,
storage_sync_service_name,
sync_group_name):
return client.create(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name)
parameters = {'properties': None}
return client.create(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, parameters=parameters)


def delete_storagesync_sync_group(client,
Expand Down Expand Up @@ -80,7 +81,7 @@ def create_storagesync_cloud_endpoint(client,
body['storage_account_resource_id'] = storage_account_resource_id # str
body['azure_file_share_name'] = azure_file_share_name # str
body['storage_account_tenant_id'] = storage_account_tenant_id # str
return sdk_no_wait(no_wait, client.create, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=body)
return sdk_no_wait(no_wait, client.begin_create, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=body)


def delete_storagesync_cloud_endpoint(client,
Expand All @@ -89,7 +90,7 @@ def delete_storagesync_cloud_endpoint(client,
sync_group_name,
cloud_endpoint_name,
no_wait=False):
return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name)
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name)


def get_storagesync_cloud_endpoint(client,
Expand Down Expand Up @@ -128,7 +129,7 @@ def create_storagesync_server_endpoint(client,
body['tier_files_older_than_days'] = tier_files_older_than_days # int
body['offline_data_transfer'] = offline_data_transfer # str
body['offline_data_transfer_share_name'] = offline_data_transfer_share_name # str
return sdk_no_wait(no_wait, client.create, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=body)
return sdk_no_wait(no_wait, client.begin_create, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=body)


def update_storagesync_server_endpoint(client,
Expand All @@ -153,7 +154,7 @@ def update_storagesync_server_endpoint(client,
body['offline_data_transfer'] = offline_data_transfer # str
if offline_data_transfer_share_name is not None:
body['offline_data_transfer_share_name'] = offline_data_transfer_share_name # str
return sdk_no_wait(no_wait, client.update, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=body)
return sdk_no_wait(no_wait, client.begin_update, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=body)


def delete_storagesync_server_endpoint(client,
Expand All @@ -162,7 +163,7 @@ def delete_storagesync_server_endpoint(client,
sync_group_name,
server_endpoint_name,
no_wait=False):
return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name)
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name)


def get_storagesync_server_endpoint(client,
Expand All @@ -185,7 +186,7 @@ def delete_storagesync_registered_server(client,
storage_sync_service_name,
server_id,
no_wait=False):
return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, server_id=server_id)
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, server_id=server_id)


def get_storagesync_registered_server(client,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# 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.
#
# 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.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._configuration import StorageSyncManagementClientConfiguration
from ._storage_sync_management_client import StorageSyncManagementClient
__all__ = ['StorageSyncManagementClient', 'StorageSyncManagementClientConfiguration']

from .version import VERSION
from ._microsoft_storage_sync import MicrosoftStorageSync
from ._version import VERSION

__version__ = VERSION
__all__ = ['MicrosoftStorageSync']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -1,48 +1,71 @@
# 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.
#
# 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.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from msrestazure import AzureConfiguration

from .version import VERSION
from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential


class MicrosoftStorageSyncConfiguration(Configuration):
"""Configuration for MicrosoftStorageSync.

class StorageSyncManagementClientConfiguration(AzureConfiguration):
"""Configuration for StorageSyncManagementClient
Note that all parameters used to create this instance are saved as instance
attributes.

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""

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

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(StorageSyncManagementClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True
super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs)

self.add_user_agent('azure-mgmt-storagesync/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-06-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-storagesync/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# 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 typing import TYPE_CHECKING

from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

from ._configuration import MicrosoftStorageSyncConfiguration
from .operations import Operations
from .operations import StorageSyncServicesOperations
from .operations import SyncGroupsOperations
from .operations import CloudEndpointsOperations
from .operations import ServerEndpointsOperations
from .operations import RegisteredServersOperations
from .operations import WorkflowsOperations
from .operations import OperationStatusOperations
from . import models


class MicrosoftStorageSync(object):
"""Microsoft Storage Sync Service API.

:ivar operations: Operations operations
:vartype operations: azure.mgmt.storagesync.operations.Operations
:ivar storage_sync_services: StorageSyncServicesOperations operations
:vartype storage_sync_services: azure.mgmt.storagesync.operations.StorageSyncServicesOperations
:ivar sync_groups: SyncGroupsOperations operations
:vartype sync_groups: azure.mgmt.storagesync.operations.SyncGroupsOperations
:ivar cloud_endpoints: CloudEndpointsOperations operations
:vartype cloud_endpoints: azure.mgmt.storagesync.operations.CloudEndpointsOperations
:ivar server_endpoints: ServerEndpointsOperations operations
:vartype server_endpoints: azure.mgmt.storagesync.operations.ServerEndpointsOperations
:ivar registered_servers: RegisteredServersOperations operations
:vartype registered_servers: azure.mgmt.storagesync.operations.RegisteredServersOperations
:ivar workflows: WorkflowsOperations operations
:vartype workflows: azure.mgmt.storagesync.operations.WorkflowsOperations
:ivar operation_status: OperationStatusOperations operations
:vartype operation_status: azure.mgmt.storagesync.operations.OperationStatusOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
base_url=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = MicrosoftStorageSyncConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
self.storage_sync_services = StorageSyncServicesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.sync_groups = SyncGroupsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.cloud_endpoints = CloudEndpointsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.server_endpoints = ServerEndpointsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.registered_servers = RegisteredServersOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workflows = WorkflowsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operation_status = OperationStatusOperations(
self._client, self._config, self._serialize, self._deserialize)

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> MicrosoftStorageSync
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Loading