Skip to content

Commit 52efb28

Browse files
authored
code and test (Azure#23047)
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
1 parent 42da414 commit 52efb28

File tree

7 files changed

+179
-37
lines changed

7 files changed

+179
-37
lines changed

sdk/loganalytics/azure-mgmt-loganalytics/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 13.0.0b2 (2022-02-14)
4+
5+
**Features**
6+
7+
- Added operation TablesOperations.migrate
8+
39
## 13.0.0b1 (2022-01-18)
410

511
**Features**

sdk/loganalytics/azure-mgmt-loganalytics/_meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"@autorest/[email protected]",
55
"@autorest/[email protected]"
66
],
7-
"commit": "23ca45b7dfce24112bc686bae70c4424f33ae69e",
7+
"commit": "24b1f9ed9a0768a55b14cced1761a40f7c12b6d2",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/operationalinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
9+
"autorest_command": "autorest specification/operationalinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
1010
"readme": "specification/operationalinsights/resource-manager/readme.md"
1111
}

sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "13.0.0b1"
9+
VERSION = "13.0.0b2"

sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/aio/operations/_tables_operations.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from ... import models as _models
2424
from ..._vendor import _convert_request
25-
from ...operations._tables_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_update_request_initial
25+
from ...operations._tables_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_migrate_request, build_update_request_initial
2626
T = TypeVar('T')
2727
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
2828

@@ -526,3 +526,56 @@ def get_long_running_output(pipeline_response):
526526
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
527527

528528
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}'} # type: ignore
529+
530+
@distributed_trace_async
531+
async def migrate(
532+
self,
533+
resource_group_name: str,
534+
workspace_name: str,
535+
table_name: str,
536+
**kwargs: Any
537+
) -> None:
538+
"""Migrate a Log Analytics table from support of the Data Collector API and Custom Fields features
539+
to support of Data Collection Rule-based Custom Logs.
540+
541+
:param resource_group_name: The name of the resource group. The name is case insensitive.
542+
:type resource_group_name: str
543+
:param workspace_name: The name of the workspace.
544+
:type workspace_name: str
545+
:param table_name: The name of the table.
546+
:type table_name: str
547+
:keyword callable cls: A custom type or function that will be passed the direct response
548+
:return: None, or the result of cls(response)
549+
:rtype: None
550+
:raises: ~azure.core.exceptions.HttpResponseError
551+
"""
552+
cls = kwargs.pop('cls', None) # type: ClsType[None]
553+
error_map = {
554+
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
555+
}
556+
error_map.update(kwargs.pop('error_map', {}))
557+
558+
559+
request = build_migrate_request(
560+
subscription_id=self._config.subscription_id,
561+
resource_group_name=resource_group_name,
562+
workspace_name=workspace_name,
563+
table_name=table_name,
564+
template_url=self.migrate.metadata['url'],
565+
)
566+
request = _convert_request(request)
567+
request.url = self._client.format_url(request.url)
568+
569+
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
570+
response = pipeline_response.http_response
571+
572+
if response.status_code not in [200]:
573+
map_error(status_code=response.status_code, response=response, error_map=error_map)
574+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
575+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
576+
577+
if cls:
578+
return cls(pipeline_response, None, {})
579+
580+
migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}/migrate'} # type: ignore
581+

sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_log_analytics_management_client_enums.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ class StorageInsightState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
245245
ERROR = "ERROR"
246246

247247
class TablePlanEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
248-
"""The table plan.
248+
"""Instruct the system how to handle and charge the logs ingested to this table.
249249
"""
250250

251-
#: Basic - logs that are adjusted to support high volume / low value verbose logs.
251+
#: Logs that are adjusted to support high volume low value verbose logs.
252252
BASIC = "Basic"
253-
#: Analytics - logs that allow monitoring and analytics.
253+
#: Logs that allow monitoring and analytics.
254254
ANALYTICS = "Analytics"
255255

256256
class TableSubTypeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):

sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,8 +1715,6 @@ def __init__(
17151715
class RestoredLogs(msrest.serialization.Model):
17161716
"""Restore parameters.
17171717
1718-
Variables are only populated by the server, and will be ignored when sending a request.
1719-
17201718
:ivar start_restore_time: The timestamp to start the restore from (UTC).
17211719
:vartype start_restore_time: ~datetime.datetime
17221720
:ivar end_restore_time: The timestamp to end the restore by (UTC).
@@ -1725,10 +1723,6 @@ class RestoredLogs(msrest.serialization.Model):
17251723
:vartype source_table: str
17261724
"""
17271725

1728-
_validation = {
1729-
'source_table': {'readonly': True},
1730-
}
1731-
17321726
_attribute_map = {
17331727
'start_restore_time': {'key': 'startRestoreTime', 'type': 'iso-8601'},
17341728
'end_restore_time': {'key': 'endRestoreTime', 'type': 'iso-8601'},
@@ -1740,18 +1734,21 @@ def __init__(
17401734
*,
17411735
start_restore_time: Optional[datetime.datetime] = None,
17421736
end_restore_time: Optional[datetime.datetime] = None,
1737+
source_table: Optional[str] = None,
17431738
**kwargs
17441739
):
17451740
"""
17461741
:keyword start_restore_time: The timestamp to start the restore from (UTC).
17471742
:paramtype start_restore_time: ~datetime.datetime
17481743
:keyword end_restore_time: The timestamp to end the restore by (UTC).
17491744
:paramtype end_restore_time: ~datetime.datetime
1745+
:keyword source_table: The table to restore data from.
1746+
:paramtype source_table: str
17501747
"""
17511748
super(RestoredLogs, self).__init__(**kwargs)
17521749
self.start_restore_time = start_restore_time
17531750
self.end_restore_time = end_restore_time
1754-
self.source_table = None
1751+
self.source_table = source_table
17551752

17561753

17571754
class ResultStatistics(msrest.serialization.Model):
@@ -2228,15 +2225,15 @@ class SearchResults(msrest.serialization.Model):
22282225
22292226
:ivar query: Search job query.
22302227
:vartype query: str
2231-
:ivar description: Search results table's Description.
2228+
:ivar description: Search job Description.
22322229
:vartype description: str
22332230
:ivar limit: Limit the search job to return up to specified number of rows.
22342231
:vartype limit: int
22352232
:ivar start_search_time: The timestamp to start the search from (UTC).
22362233
:vartype start_search_time: ~datetime.datetime
22372234
:ivar end_search_time: The timestamp to end the search by (UTC).
22382235
:vartype end_search_time: ~datetime.datetime
2239-
:ivar source_table: The table to search data from.
2236+
:ivar source_table: The table used in the search job.
22402237
:vartype source_table: str
22412238
"""
22422239

@@ -2266,7 +2263,7 @@ def __init__(
22662263
"""
22672264
:keyword query: Search job query.
22682265
:paramtype query: str
2269-
:keyword description: Search results table's Description.
2266+
:keyword description: Search job Description.
22702267
:paramtype description: str
22712268
:keyword limit: Limit the search job to return up to specified number of rows.
22722269
:paramtype limit: int
@@ -2690,11 +2687,11 @@ class Table(ProxyResource):
26902687
:vartype type: str
26912688
:ivar system_data: Metadata pertaining to creation and last modification of the resource.
26922689
:vartype system_data: ~azure.mgmt.loganalytics.models.SystemData
2693-
:ivar retention_in_days: The data table data retention in days, between 4 and 730. Setting this
2694-
property to null will default to the workspace retention.
2690+
:ivar retention_in_days: The table retention in days, between 4 and 730. Setting this property
2691+
to -1 will default to the workspace retention.
26952692
:vartype retention_in_days: int
2696-
:ivar total_retention_in_days: The table data total retention in days, between 4 and 2555.
2697-
Setting this property to null will default to table retention.
2693+
:ivar total_retention_in_days: The table total retention in days, between 4 and 2555. Setting
2694+
this property to -1 will default to table retention.
26982695
:vartype total_retention_in_days: int
26992696
:ivar archive_retention_in_days: The table data archive retention in days. Calculated as
27002697
(totalRetentionInDays-retentionInDays).
@@ -2705,7 +2702,8 @@ class Table(ProxyResource):
27052702
:vartype restored_logs: ~azure.mgmt.loganalytics.models.RestoredLogs
27062703
:ivar result_statistics: Search job execution statistics.
27072704
:vartype result_statistics: ~azure.mgmt.loganalytics.models.ResultStatistics
2708-
:ivar plan: The table plan. Possible values include: "Basic", "Analytics".
2705+
:ivar plan: Instruct the system how to handle and charge the logs ingested to this table.
2706+
Possible values include: "Basic", "Analytics".
27092707
:vartype plan: str or ~azure.mgmt.loganalytics.models.TablePlanEnum
27102708
:ivar last_plan_modified_date: The timestamp that table plan was last modified (UTC).
27112709
:vartype last_plan_modified_date: str
@@ -2759,19 +2757,20 @@ def __init__(
27592757
**kwargs
27602758
):
27612759
"""
2762-
:keyword retention_in_days: The data table data retention in days, between 4 and 730. Setting
2763-
this property to null will default to the workspace retention.
2760+
:keyword retention_in_days: The table retention in days, between 4 and 730. Setting this
2761+
property to -1 will default to the workspace retention.
27642762
:paramtype retention_in_days: int
2765-
:keyword total_retention_in_days: The table data total retention in days, between 4 and 2555.
2766-
Setting this property to null will default to table retention.
2763+
:keyword total_retention_in_days: The table total retention in days, between 4 and 2555.
2764+
Setting this property to -1 will default to table retention.
27672765
:paramtype total_retention_in_days: int
27682766
:keyword search_results: Parameters of the search job that initiated this table.
27692767
:paramtype search_results: ~azure.mgmt.loganalytics.models.SearchResults
27702768
:keyword restored_logs: Parameters of the restore operation that initiated this table.
27712769
:paramtype restored_logs: ~azure.mgmt.loganalytics.models.RestoredLogs
27722770
:keyword result_statistics: Search job execution statistics.
27732771
:paramtype result_statistics: ~azure.mgmt.loganalytics.models.ResultStatistics
2774-
:keyword plan: The table plan. Possible values include: "Basic", "Analytics".
2772+
:keyword plan: Instruct the system how to handle and charge the logs ingested to this table.
2773+
Possible values include: "Basic", "Analytics".
27752774
:paramtype plan: str or ~azure.mgmt.loganalytics.models.TablePlanEnum
27762775
:keyword schema: Table schema.
27772776
:paramtype schema: ~azure.mgmt.loganalytics.models.Schema
@@ -3015,6 +3014,7 @@ class Workspace(TrackedResource):
30153014
'type': {'readonly': True},
30163015
'location': {'required': True},
30173016
'system_data': {'readonly': True},
3017+
'provisioning_state': {'readonly': True},
30183018
'customer_id': {'readonly': True},
30193019
'created_date': {'readonly': True},
30203020
'modified_date': {'readonly': True},
@@ -3050,7 +3050,6 @@ def __init__(
30503050
location: str,
30513051
tags: Optional[Dict[str, str]] = None,
30523052
e_tag: Optional[str] = None,
3053-
provisioning_state: Optional[Union[str, "WorkspaceEntityStatus"]] = None,
30543053
sku: Optional["WorkspaceSku"] = None,
30553054
retention_in_days: Optional[int] = None,
30563055
workspace_capping: Optional["WorkspaceCapping"] = None,
@@ -3068,9 +3067,6 @@ def __init__(
30683067
:paramtype location: str
30693068
:keyword e_tag: The ETag of the workspace.
30703069
:paramtype e_tag: str
3071-
:keyword provisioning_state: The provisioning state of the workspace. Possible values include:
3072-
"Creating", "Succeeded", "Failed", "Canceled", "Deleting", "ProvisioningAccount", "Updating".
3073-
:paramtype provisioning_state: str or ~azure.mgmt.loganalytics.models.WorkspaceEntityStatus
30743070
:keyword sku: The SKU of the workspace.
30753071
:paramtype sku: ~azure.mgmt.loganalytics.models.WorkspaceSku
30763072
:keyword retention_in_days: The workspace data retention in days. Allowed values are per
@@ -3099,7 +3095,7 @@ def __init__(
30993095
super(Workspace, self).__init__(tags=tags, location=location, **kwargs)
31003096
self.system_data = None
31013097
self.e_tag = e_tag
3102-
self.provisioning_state = provisioning_state
3098+
self.provisioning_state = None
31033099
self.customer_id = None
31043100
self.sku = sku
31053101
self.retention_in_days = retention_in_days
@@ -3358,6 +3354,7 @@ class WorkspacePatch(AzureEntityResource):
33583354
'name': {'readonly': True},
33593355
'type': {'readonly': True},
33603356
'etag': {'readonly': True},
3357+
'provisioning_state': {'readonly': True},
33613358
'customer_id': {'readonly': True},
33623359
'created_date': {'readonly': True},
33633360
'modified_date': {'readonly': True},
@@ -3389,7 +3386,6 @@ def __init__(
33893386
self,
33903387
*,
33913388
tags: Optional[Dict[str, str]] = None,
3392-
provisioning_state: Optional[Union[str, "WorkspaceEntityStatus"]] = None,
33933389
sku: Optional["WorkspaceSku"] = None,
33943390
retention_in_days: Optional[int] = None,
33953391
workspace_capping: Optional["WorkspaceCapping"] = None,
@@ -3403,9 +3399,6 @@ def __init__(
34033399
"""
34043400
:keyword tags: A set of tags. Resource tags. Optional.
34053401
:paramtype tags: dict[str, str]
3406-
:keyword provisioning_state: The provisioning state of the workspace. Possible values include:
3407-
"Creating", "Succeeded", "Failed", "Canceled", "Deleting", "ProvisioningAccount", "Updating".
3408-
:paramtype provisioning_state: str or ~azure.mgmt.loganalytics.models.WorkspaceEntityStatus
34093402
:keyword sku: The SKU of the workspace.
34103403
:paramtype sku: ~azure.mgmt.loganalytics.models.WorkspaceSku
34113404
:keyword retention_in_days: The workspace data retention in days. Allowed values are per
@@ -3433,7 +3426,7 @@ def __init__(
34333426
"""
34343427
super(WorkspacePatch, self).__init__(**kwargs)
34353428
self.tags = tags
3436-
self.provisioning_state = provisioning_state
3429+
self.provisioning_state = None
34373430
self.customer_id = None
34383431
self.sku = sku
34393432
self.retention_in_days = retention_in_days

0 commit comments

Comments
 (0)