From 6c0886c5f8bdf61ee33babd14bd9157e1087c6ee Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 27 May 2020 20:59:01 +0000 Subject: [PATCH 1/2] Update from master --- .../_log_analytics_management_client.py | 15 ++ .../mgmt/loganalytics/models/__init__.py | 13 + .../_log_analytics_management_client_enums.py | 10 + .../azure/mgmt/loganalytics/models/_models.py | 154 ++++++++++- .../mgmt/loganalytics/models/_models_py3.py | 162 +++++++++++- .../mgmt/loganalytics/models/_paged_models.py | 13 + .../mgmt/loganalytics/operations/__init__.py | 6 + .../_available_service_tiers_operations.py | 102 +++++++ .../_deleted_workspaces_operations.py | 178 +++++++++++++ .../operations/_tables_operations.py | 249 ++++++++++++++++++ .../operations/_workspaces_operations.py | 78 +----- .../azure-mgmt-loganalytics/setup.py | 4 +- 12 files changed, 902 insertions(+), 82 deletions(-) create mode 100644 sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_available_service_tiers_operations.py create mode 100644 sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_deleted_workspaces_operations.py create mode 100644 sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_tables_operations.py diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/_log_analytics_management_client.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/_log_analytics_management_client.py index 362afbc9ad03..a7588e7b0e20 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/_log_analytics_management_client.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/_log_analytics_management_client.py @@ -24,12 +24,15 @@ from .operations import SharedKeysOperations from .operations import UsagesOperations from .operations import WorkspacesOperations +from .operations import DeletedWorkspacesOperations from .operations import ClustersOperations from .operations import StorageInsightConfigsOperations from .operations import SavedSearchesOperations +from .operations import AvailableServiceTiersOperations from .operations import GatewaysOperations from .operations import SchemaOperations from .operations import WorkspacePurgeOperations +from .operations import TablesOperations from . import models @@ -61,18 +64,24 @@ class LogAnalyticsManagementClient(SDKClient): :vartype usages: azure.mgmt.loganalytics.operations.UsagesOperations :ivar workspaces: Workspaces operations :vartype workspaces: azure.mgmt.loganalytics.operations.WorkspacesOperations + :ivar deleted_workspaces: DeletedWorkspaces operations + :vartype deleted_workspaces: azure.mgmt.loganalytics.operations.DeletedWorkspacesOperations :ivar clusters: Clusters operations :vartype clusters: azure.mgmt.loganalytics.operations.ClustersOperations :ivar storage_insight_configs: StorageInsightConfigs operations :vartype storage_insight_configs: azure.mgmt.loganalytics.operations.StorageInsightConfigsOperations :ivar saved_searches: SavedSearches operations :vartype saved_searches: azure.mgmt.loganalytics.operations.SavedSearchesOperations + :ivar available_service_tiers: AvailableServiceTiers operations + :vartype available_service_tiers: azure.mgmt.loganalytics.operations.AvailableServiceTiersOperations :ivar gateways: Gateways operations :vartype gateways: azure.mgmt.loganalytics.operations.GatewaysOperations :ivar schema: Schema operations :vartype schema: azure.mgmt.loganalytics.operations.SchemaOperations :ivar workspace_purge: WorkspacePurge operations :vartype workspace_purge: azure.mgmt.loganalytics.operations.WorkspacePurgeOperations + :ivar tables: Tables operations + :vartype tables: azure.mgmt.loganalytics.operations.TablesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -115,15 +124,21 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.workspaces = WorkspacesOperations( self._client, self.config, self._serialize, self._deserialize) + self.deleted_workspaces = DeletedWorkspacesOperations( + self._client, self.config, self._serialize, self._deserialize) self.clusters = ClustersOperations( self._client, self.config, self._serialize, self._deserialize) self.storage_insight_configs = StorageInsightConfigsOperations( self._client, self.config, self._serialize, self._deserialize) self.saved_searches = SavedSearchesOperations( self._client, self.config, self._serialize, self._deserialize) + self.available_service_tiers = AvailableServiceTiersOperations( + self._client, self.config, self._serialize, self._deserialize) self.gateways = GatewaysOperations( self._client, self.config, self._serialize, self._deserialize) self.schema = SchemaOperations( self._client, self.config, self._serialize, self._deserialize) self.workspace_purge = WorkspacePurgeOperations( self._client, self.config, self._serialize, self._deserialize) + self.tables = TablesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/__init__.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/__init__.py index 9770f8b73072..44af1d1c9917 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/__init__.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/__init__.py @@ -22,6 +22,7 @@ from ._models_py3 import DataSource from ._models_py3 import DataSourceFilter from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorContract, ErrorContractException from ._models_py3 import ErrorResponse from ._models_py3 import Identity from ._models_py3 import IntelligencePack @@ -47,10 +48,12 @@ from ._models_py3 import StorageAccount from ._models_py3 import StorageInsight from ._models_py3 import StorageInsightStatus + from ._models_py3 import Table from ._models_py3 import Tag from ._models_py3 import TrackedResource from ._models_py3 import UsageMetric from ._models_py3 import Workspace + from ._models_py3 import WorkspaceCapping from ._models_py3 import WorkspacePatch from ._models_py3 import WorkspacePurgeBody from ._models_py3 import WorkspacePurgeBodyFilters @@ -70,6 +73,7 @@ from ._models import DataSource from ._models import DataSourceFilter from ._models import ErrorAdditionalInfo + from ._models import ErrorContract, ErrorContractException from ._models import ErrorResponse from ._models import Identity from ._models import IntelligencePack @@ -95,10 +99,12 @@ from ._models import StorageAccount from ._models import StorageInsight from ._models import StorageInsightStatus + from ._models import Table from ._models import Tag from ._models import TrackedResource from ._models import UsageMetric from ._models import Workspace + from ._models import WorkspaceCapping from ._models import WorkspacePatch from ._models import WorkspacePurgeBody from ._models import WorkspacePurgeBodyFilters @@ -113,6 +119,7 @@ from ._paged_models import ManagementGroupPaged from ._paged_models import OperationPaged from ._paged_models import StorageInsightPaged +from ._paged_models import TablePaged from ._paged_models import UsageMetricPaged from ._paged_models import WorkspacePaged from ._log_analytics_management_client_enums import ( @@ -121,6 +128,7 @@ LinkedServiceEntityStatus, DataSourceType, WorkspaceSkuNameEnum, + DataIngestionStatus, WorkspaceEntityStatus, PublicNetworkAccessType, ClusterEntityStatus, @@ -145,6 +153,7 @@ 'DataSource', 'DataSourceFilter', 'ErrorAdditionalInfo', + 'ErrorContract', 'ErrorContractException', 'ErrorResponse', 'Identity', 'IntelligencePack', @@ -170,10 +179,12 @@ 'StorageAccount', 'StorageInsight', 'StorageInsightStatus', + 'Table', 'Tag', 'TrackedResource', 'UsageMetric', 'Workspace', + 'WorkspaceCapping', 'WorkspacePatch', 'WorkspacePurgeBody', 'WorkspacePurgeBodyFilters', @@ -190,11 +201,13 @@ 'WorkspacePaged', 'ClusterPaged', 'StorageInsightPaged', + 'TablePaged', 'Type', 'DataSourceKind', 'LinkedServiceEntityStatus', 'DataSourceType', 'WorkspaceSkuNameEnum', + 'DataIngestionStatus', 'WorkspaceEntityStatus', 'PublicNetworkAccessType', 'ClusterEntityStatus', diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_log_analytics_management_client_enums.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_log_analytics_management_client_enums.py index 849d8895a5e7..47c8945b9279 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_log_analytics_management_client_enums.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_log_analytics_management_client_enums.py @@ -80,6 +80,16 @@ class WorkspaceSkuNameEnum(str, Enum): capacity_reservation = "CapacityReservation" +class DataIngestionStatus(str, Enum): + + respect_quota = "RespectQuota" + force_on = "ForceOn" + force_off = "ForceOff" + over_quota = "OverQuota" + subscription_suspended = "SubscriptionSuspended" + approaching_quota = "ApproachingQuota" + + class WorkspaceEntityStatus(str, Enum): creating = "Creating" diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py index bb1bd8a415b8..61269424b641 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py @@ -39,7 +39,7 @@ class AvailableServiceTier(Model): :vartype capacity_reservation_level: long :ivar last_sku_update: Time when the sku was last updated for the workspace. Returned for the Capacity Reservation Service Tier. - :vartype last_sku_update: datetime + :vartype last_sku_update: str """ _validation = { @@ -59,7 +59,7 @@ class AvailableServiceTier(Model): 'maximum_retention': {'key': 'maximumRetention', 'type': 'long'}, 'default_retention': {'key': 'defaultRetention', 'type': 'long'}, 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'long'}, - 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'iso-8601'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, } def __init__(self, **kwargs): @@ -636,6 +636,36 @@ def __init__(self, **kwargs): self.info = None +class ErrorContract(Model): + """Error details. + + Contains details when the response code indicates an error. + + :param error: The details of the error. + :type error: ~azure.mgmt.loganalytics.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(ErrorContract, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorContractException(HttpOperationError): + """Server responsed with exception of type: 'ErrorContract'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) + + class ErrorResponse(Model): """The resource management error response. @@ -1063,11 +1093,16 @@ class SavedSearch(ProxyResource): :type category: str :param display_name: Required. Saved search display name. :type display_name: str - :param query: Required. The query expression for the saved search. Please - see - https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-search-reference - for reference. + :param query: Required. The query expression for the saved search. :type query: str + :param function_alias: The function alias if query serves as a function. + :type function_alias: str + :param function_parameters: The optional function parameters if query + serves as a function. Value should be in the following format: + 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. + For more examples and proper syntax please refer to + https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + :type function_parameters: str :param version: The version number of the query language. The current version is 2 and is the default. :type version: long @@ -1092,6 +1127,8 @@ class SavedSearch(ProxyResource): 'category': {'key': 'properties.category', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'query': {'key': 'properties.query', 'type': 'str'}, + 'function_alias': {'key': 'properties.functionAlias', 'type': 'str'}, + 'function_parameters': {'key': 'properties.functionParameters', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'long'}, 'tags': {'key': 'properties.tags', 'type': '[Tag]'}, } @@ -1102,6 +1139,8 @@ def __init__(self, **kwargs): self.category = kwargs.get('category', None) self.display_name = kwargs.get('display_name', None) self.query = kwargs.get('query', None) + self.function_alias = kwargs.get('function_alias', None) + self.function_parameters = kwargs.get('function_parameters', None) self.version = kwargs.get('version', None) self.tags = kwargs.get('tags', None) @@ -1451,6 +1490,45 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class Table(ProxyResource): + """Workspace data table definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param retention_in_days: The data table data retention in days, between + 30 and 730. Setting this property to null will default to the workspace + retention. + :type retention_in_days: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'retention_in_days': {'maximum': 730, 'minimum': 30}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'retention_in_days': {'key': 'properties.retentionInDays', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Table, self).__init__(**kwargs) + self.retention_in_days = kwargs.get('retention_in_days', None) + + class Tag(Model): """A tag of a saved search. @@ -1549,6 +1627,8 @@ class Workspace(TrackedResource): Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. :type retention_in_days: int + :param workspace_capping: The daily volume cap for ingestion. + :type workspace_capping: ~azure.mgmt.loganalytics.models.WorkspaceCapping :param public_network_access_for_ingestion: The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. Default value: "Enabled" . @@ -1587,6 +1667,7 @@ class Workspace(TrackedResource): 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, 'sku': {'key': 'properties.sku', 'type': 'WorkspaceSku'}, 'retention_in_days': {'key': 'properties.retentionInDays', 'type': 'int'}, + 'workspace_capping': {'key': 'properties.workspaceCapping', 'type': 'WorkspaceCapping'}, 'public_network_access_for_ingestion': {'key': 'properties.publicNetworkAccessForIngestion', 'type': 'str'}, 'public_network_access_for_query': {'key': 'properties.publicNetworkAccessForQuery', 'type': 'str'}, 'private_link_scoped_resources': {'key': 'properties.privateLinkScopedResources', 'type': '[PrivateLinkScopedResource]'}, @@ -1599,12 +1680,49 @@ def __init__(self, **kwargs): self.customer_id = None self.sku = kwargs.get('sku', None) self.retention_in_days = kwargs.get('retention_in_days', None) + self.workspace_capping = kwargs.get('workspace_capping', None) self.public_network_access_for_ingestion = kwargs.get('public_network_access_for_ingestion', "Enabled") self.public_network_access_for_query = kwargs.get('public_network_access_for_query', "Enabled") self.private_link_scoped_resources = None self.e_tag = kwargs.get('e_tag', None) +class WorkspaceCapping(Model): + """The daily volume cap for ingestion. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param daily_quota_gb: The workspace daily quota for ingestion. -1 means + unlimited. + :type daily_quota_gb: float + :ivar quota_next_reset_time: The time when the quota will be rest. + :vartype quota_next_reset_time: str + :ivar data_ingestion_status: The status of data ingestion for this + workspace. Possible values include: 'RespectQuota', 'ForceOn', 'ForceOff', + 'OverQuota', 'SubscriptionSuspended', 'ApproachingQuota' + :vartype data_ingestion_status: str or + ~azure.mgmt.loganalytics.models.DataIngestionStatus + """ + + _validation = { + 'quota_next_reset_time': {'readonly': True}, + 'data_ingestion_status': {'readonly': True}, + } + + _attribute_map = { + 'daily_quota_gb': {'key': 'dailyQuotaGb', 'type': 'float'}, + 'quota_next_reset_time': {'key': 'quotaNextResetTime', 'type': 'str'}, + 'data_ingestion_status': {'key': 'dataIngestionStatus', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WorkspaceCapping, self).__init__(**kwargs) + self.daily_quota_gb = kwargs.get('daily_quota_gb', None) + self.quota_next_reset_time = None + self.data_ingestion_status = None + + class WorkspacePatch(AzureEntityResource): """The top level Workspace resource container. @@ -1635,6 +1753,8 @@ class WorkspacePatch(AzureEntityResource): Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. :type retention_in_days: int + :param workspace_capping: The daily volume cap for ingestion. + :type workspace_capping: ~azure.mgmt.loganalytics.models.WorkspaceCapping :param public_network_access_for_ingestion: The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. Default value: "Enabled" . @@ -1672,6 +1792,7 @@ class WorkspacePatch(AzureEntityResource): 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, 'sku': {'key': 'properties.sku', 'type': 'WorkspaceSku'}, 'retention_in_days': {'key': 'properties.retentionInDays', 'type': 'int'}, + 'workspace_capping': {'key': 'properties.workspaceCapping', 'type': 'WorkspaceCapping'}, 'public_network_access_for_ingestion': {'key': 'properties.publicNetworkAccessForIngestion', 'type': 'str'}, 'public_network_access_for_query': {'key': 'properties.publicNetworkAccessForQuery', 'type': 'str'}, 'private_link_scoped_resources': {'key': 'properties.privateLinkScopedResources', 'type': '[PrivateLinkScopedResource]'}, @@ -1684,6 +1805,7 @@ def __init__(self, **kwargs): self.customer_id = None self.sku = kwargs.get('sku', None) self.retention_in_days = kwargs.get('retention_in_days', None) + self.workspace_capping = kwargs.get('workspace_capping', None) self.public_network_access_for_ingestion = kwargs.get('public_network_access_for_ingestion', "Enabled") self.public_network_access_for_query = kwargs.get('public_network_access_for_query', "Enabled") self.private_link_scoped_resources = None @@ -1802,22 +1924,42 @@ def __init__(self, **kwargs): class WorkspaceSku(Model): """The SKU (tier) of a workspace. + Variables are only populated by the server, and will be ignored when + sending a request. + All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation' :type name: str or ~azure.mgmt.loganalytics.models.WorkspaceSkuNameEnum + :param capacity_reservation_level: The capacity reservation level for this + workspace, when CapacityReservation sku is selected. + :type capacity_reservation_level: int + :ivar max_capacity_reservation_level: The maximum capacity reservation + level available for this workspace, when CapacityReservation sku is + selected. + :vartype max_capacity_reservation_level: int + :ivar last_sku_update: The last time when the sku was updated. + :vartype last_sku_update: str """ _validation = { 'name': {'required': True}, + 'max_capacity_reservation_level': {'readonly': True}, + 'last_sku_update': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'int'}, + 'max_capacity_reservation_level': {'key': 'maxCapacityReservationLevel', 'type': 'int'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, } def __init__(self, **kwargs): super(WorkspaceSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) + self.capacity_reservation_level = kwargs.get('capacity_reservation_level', None) + self.max_capacity_reservation_level = None + self.last_sku_update = None diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py index 15cd80e08782..6640ff898a3e 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py @@ -39,7 +39,7 @@ class AvailableServiceTier(Model): :vartype capacity_reservation_level: long :ivar last_sku_update: Time when the sku was last updated for the workspace. Returned for the Capacity Reservation Service Tier. - :vartype last_sku_update: datetime + :vartype last_sku_update: str """ _validation = { @@ -59,7 +59,7 @@ class AvailableServiceTier(Model): 'maximum_retention': {'key': 'maximumRetention', 'type': 'long'}, 'default_retention': {'key': 'defaultRetention', 'type': 'long'}, 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'long'}, - 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'iso-8601'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, } def __init__(self, **kwargs) -> None: @@ -636,6 +636,36 @@ def __init__(self, **kwargs) -> None: self.info = None +class ErrorContract(Model): + """Error details. + + Contains details when the response code indicates an error. + + :param error: The details of the error. + :type error: ~azure.mgmt.loganalytics.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorContract, self).__init__(**kwargs) + self.error = error + + +class ErrorContractException(HttpOperationError): + """Server responsed with exception of type: 'ErrorContract'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) + + class ErrorResponse(Model): """The resource management error response. @@ -1063,11 +1093,16 @@ class SavedSearch(ProxyResource): :type category: str :param display_name: Required. Saved search display name. :type display_name: str - :param query: Required. The query expression for the saved search. Please - see - https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-search-reference - for reference. + :param query: Required. The query expression for the saved search. :type query: str + :param function_alias: The function alias if query serves as a function. + :type function_alias: str + :param function_parameters: The optional function parameters if query + serves as a function. Value should be in the following format: + 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. + For more examples and proper syntax please refer to + https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + :type function_parameters: str :param version: The version number of the query language. The current version is 2 and is the default. :type version: long @@ -1092,16 +1127,20 @@ class SavedSearch(ProxyResource): 'category': {'key': 'properties.category', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'query': {'key': 'properties.query', 'type': 'str'}, + 'function_alias': {'key': 'properties.functionAlias', 'type': 'str'}, + 'function_parameters': {'key': 'properties.functionParameters', 'type': 'str'}, 'version': {'key': 'properties.version', 'type': 'long'}, 'tags': {'key': 'properties.tags', 'type': '[Tag]'}, } - def __init__(self, *, category: str, display_name: str, query: str, e_tag: str=None, version: int=None, tags=None, **kwargs) -> None: + def __init__(self, *, category: str, display_name: str, query: str, e_tag: str=None, function_alias: str=None, function_parameters: str=None, version: int=None, tags=None, **kwargs) -> None: super(SavedSearch, self).__init__(**kwargs) self.e_tag = e_tag self.category = category self.display_name = display_name self.query = query + self.function_alias = function_alias + self.function_parameters = function_parameters self.version = version self.tags = tags @@ -1451,6 +1490,45 @@ def __init__(self, *, state, description: str=None, **kwargs) -> None: self.description = description +class Table(ProxyResource): + """Workspace data table definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param retention_in_days: The data table data retention in days, between + 30 and 730. Setting this property to null will default to the workspace + retention. + :type retention_in_days: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'retention_in_days': {'maximum': 730, 'minimum': 30}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'retention_in_days': {'key': 'properties.retentionInDays', 'type': 'int'}, + } + + def __init__(self, *, retention_in_days: int=None, **kwargs) -> None: + super(Table, self).__init__(**kwargs) + self.retention_in_days = retention_in_days + + class Tag(Model): """A tag of a saved search. @@ -1549,6 +1627,8 @@ class Workspace(TrackedResource): Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. :type retention_in_days: int + :param workspace_capping: The daily volume cap for ingestion. + :type workspace_capping: ~azure.mgmt.loganalytics.models.WorkspaceCapping :param public_network_access_for_ingestion: The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. Default value: "Enabled" . @@ -1587,24 +1667,62 @@ class Workspace(TrackedResource): 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, 'sku': {'key': 'properties.sku', 'type': 'WorkspaceSku'}, 'retention_in_days': {'key': 'properties.retentionInDays', 'type': 'int'}, + 'workspace_capping': {'key': 'properties.workspaceCapping', 'type': 'WorkspaceCapping'}, 'public_network_access_for_ingestion': {'key': 'properties.publicNetworkAccessForIngestion', 'type': 'str'}, 'public_network_access_for_query': {'key': 'properties.publicNetworkAccessForQuery', 'type': 'str'}, 'private_link_scoped_resources': {'key': 'properties.privateLinkScopedResources', 'type': '[PrivateLinkScopedResource]'}, 'e_tag': {'key': 'eTag', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, provisioning_state=None, sku=None, retention_in_days: int=None, public_network_access_for_ingestion="Enabled", public_network_access_for_query="Enabled", e_tag: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, provisioning_state=None, sku=None, retention_in_days: int=None, workspace_capping=None, public_network_access_for_ingestion="Enabled", public_network_access_for_query="Enabled", e_tag: str=None, **kwargs) -> None: super(Workspace, self).__init__(tags=tags, location=location, **kwargs) self.provisioning_state = provisioning_state self.customer_id = None self.sku = sku self.retention_in_days = retention_in_days + self.workspace_capping = workspace_capping self.public_network_access_for_ingestion = public_network_access_for_ingestion self.public_network_access_for_query = public_network_access_for_query self.private_link_scoped_resources = None self.e_tag = e_tag +class WorkspaceCapping(Model): + """The daily volume cap for ingestion. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param daily_quota_gb: The workspace daily quota for ingestion. -1 means + unlimited. + :type daily_quota_gb: float + :ivar quota_next_reset_time: The time when the quota will be rest. + :vartype quota_next_reset_time: str + :ivar data_ingestion_status: The status of data ingestion for this + workspace. Possible values include: 'RespectQuota', 'ForceOn', 'ForceOff', + 'OverQuota', 'SubscriptionSuspended', 'ApproachingQuota' + :vartype data_ingestion_status: str or + ~azure.mgmt.loganalytics.models.DataIngestionStatus + """ + + _validation = { + 'quota_next_reset_time': {'readonly': True}, + 'data_ingestion_status': {'readonly': True}, + } + + _attribute_map = { + 'daily_quota_gb': {'key': 'dailyQuotaGb', 'type': 'float'}, + 'quota_next_reset_time': {'key': 'quotaNextResetTime', 'type': 'str'}, + 'data_ingestion_status': {'key': 'dataIngestionStatus', 'type': 'str'}, + } + + def __init__(self, *, daily_quota_gb: float=None, **kwargs) -> None: + super(WorkspaceCapping, self).__init__(**kwargs) + self.daily_quota_gb = daily_quota_gb + self.quota_next_reset_time = None + self.data_ingestion_status = None + + class WorkspacePatch(AzureEntityResource): """The top level Workspace resource container. @@ -1635,6 +1753,8 @@ class WorkspacePatch(AzureEntityResource): Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. :type retention_in_days: int + :param workspace_capping: The daily volume cap for ingestion. + :type workspace_capping: ~azure.mgmt.loganalytics.models.WorkspaceCapping :param public_network_access_for_ingestion: The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. Default value: "Enabled" . @@ -1672,18 +1792,20 @@ class WorkspacePatch(AzureEntityResource): 'customer_id': {'key': 'properties.customerId', 'type': 'str'}, 'sku': {'key': 'properties.sku', 'type': 'WorkspaceSku'}, 'retention_in_days': {'key': 'properties.retentionInDays', 'type': 'int'}, + 'workspace_capping': {'key': 'properties.workspaceCapping', 'type': 'WorkspaceCapping'}, 'public_network_access_for_ingestion': {'key': 'properties.publicNetworkAccessForIngestion', 'type': 'str'}, 'public_network_access_for_query': {'key': 'properties.publicNetworkAccessForQuery', 'type': 'str'}, 'private_link_scoped_resources': {'key': 'properties.privateLinkScopedResources', 'type': '[PrivateLinkScopedResource]'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, provisioning_state=None, sku=None, retention_in_days: int=None, public_network_access_for_ingestion="Enabled", public_network_access_for_query="Enabled", tags=None, **kwargs) -> None: + def __init__(self, *, provisioning_state=None, sku=None, retention_in_days: int=None, workspace_capping=None, public_network_access_for_ingestion="Enabled", public_network_access_for_query="Enabled", tags=None, **kwargs) -> None: super(WorkspacePatch, self).__init__(**kwargs) self.provisioning_state = provisioning_state self.customer_id = None self.sku = sku self.retention_in_days = retention_in_days + self.workspace_capping = workspace_capping self.public_network_access_for_ingestion = public_network_access_for_ingestion self.public_network_access_for_query = public_network_access_for_query self.private_link_scoped_resources = None @@ -1802,22 +1924,42 @@ def __init__(self, *, status, **kwargs) -> None: class WorkspaceSku(Model): """The SKU (tier) of a workspace. + Variables are only populated by the server, and will be ignored when + sending a request. + All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation' :type name: str or ~azure.mgmt.loganalytics.models.WorkspaceSkuNameEnum + :param capacity_reservation_level: The capacity reservation level for this + workspace, when CapacityReservation sku is selected. + :type capacity_reservation_level: int + :ivar max_capacity_reservation_level: The maximum capacity reservation + level available for this workspace, when CapacityReservation sku is + selected. + :vartype max_capacity_reservation_level: int + :ivar last_sku_update: The last time when the sku was updated. + :vartype last_sku_update: str """ _validation = { 'name': {'required': True}, + 'max_capacity_reservation_level': {'readonly': True}, + 'last_sku_update': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'int'}, + 'max_capacity_reservation_level': {'key': 'maxCapacityReservationLevel', 'type': 'int'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, } - def __init__(self, *, name, **kwargs) -> None: + def __init__(self, *, name, capacity_reservation_level: int=None, **kwargs) -> None: super(WorkspaceSku, self).__init__(**kwargs) self.name = name + self.capacity_reservation_level = capacity_reservation_level + self.max_capacity_reservation_level = None + self.last_sku_update = None diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_paged_models.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_paged_models.py index 29e30db6410f..0c350899ea5e 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_paged_models.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_paged_models.py @@ -142,3 +142,16 @@ class StorageInsightPaged(Paged): def __init__(self, *args, **kwargs): super(StorageInsightPaged, self).__init__(*args, **kwargs) +class TablePaged(Paged): + """ + A paging container for iterating over a list of :class:`Table ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Table]'} + } + + def __init__(self, *args, **kwargs): + + super(TablePaged, self).__init__(*args, **kwargs) diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/__init__.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/__init__.py index 074a8cd5a0a9..2e6d57fee68a 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/__init__.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/__init__.py @@ -20,12 +20,15 @@ from ._shared_keys_operations import SharedKeysOperations from ._usages_operations import UsagesOperations from ._workspaces_operations import WorkspacesOperations +from ._deleted_workspaces_operations import DeletedWorkspacesOperations from ._clusters_operations import ClustersOperations from ._storage_insight_configs_operations import StorageInsightConfigsOperations from ._saved_searches_operations import SavedSearchesOperations +from ._available_service_tiers_operations import AvailableServiceTiersOperations from ._gateways_operations import GatewaysOperations from ._schema_operations import SchemaOperations from ._workspace_purge_operations import WorkspacePurgeOperations +from ._tables_operations import TablesOperations __all__ = [ 'DataExportsOperations', @@ -39,10 +42,13 @@ 'SharedKeysOperations', 'UsagesOperations', 'WorkspacesOperations', + 'DeletedWorkspacesOperations', 'ClustersOperations', 'StorageInsightConfigsOperations', 'SavedSearchesOperations', + 'AvailableServiceTiersOperations', 'GatewaysOperations', 'SchemaOperations', 'WorkspacePurgeOperations', + 'TablesOperations', ] diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_available_service_tiers_operations.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_available_service_tiers_operations.py new file mode 100644 index 000000000000..74ec0b2876c4 --- /dev/null +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_available_service_tiers_operations.py @@ -0,0 +1,102 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class AvailableServiceTiersOperations(object): + """AvailableServiceTiersOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-03-01-preview" + + self.config = config + + def list_by_workspace( + self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + """Gets the available service tiers for the workspace. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: list or ClientRawResponse if raw=true + :rtype: list[~azure.mgmt.loganalytics.models.AvailableServiceTier] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_by_workspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=63, min_length=4, pattern=r'^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('[AvailableServiceTier]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers'} diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_deleted_workspaces_operations.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_deleted_workspaces_operations.py new file mode 100644 index 000000000000..bd07e4bd7510 --- /dev/null +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_deleted_workspaces_operations.py @@ -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. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DeletedWorkspacesOperations(object): + """DeletedWorkspacesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets recently deleted workspaces in a subscription, available for + recovery. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Workspace + :rtype: + ~azure.mgmt.loganalytics.models.WorkspacePaged[~azure.mgmt.loganalytics.models.Workspace] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.WorkspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets recently deleted workspaces in a resource group, available for + recovery. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Workspace + :rtype: + ~azure.mgmt.loganalytics.models.WorkspacePaged[~azure.mgmt.loganalytics.models.Workspace] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.WorkspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/deletedWorkspaces'} diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_tables_operations.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_tables_operations.py new file mode 100644 index 000000000000..6267368a1933 --- /dev/null +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_tables_operations.py @@ -0,0 +1,249 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class TablesOperations(object): + """TablesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-03-01-preview" + + self.config = config + + def list_by_workspace( + self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + """Gets all the tables for the specified Log Analytics workspace. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Table + :rtype: + ~azure.mgmt.loganalytics.models.TablePaged[~azure.mgmt.loganalytics.models.Table] + :raises: + :class:`ErrorContractException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_workspace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=63, min_length=4, pattern=r'^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorContractException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TablePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables'} + + def update( + self, resource_group_name, workspace_name, table_name, retention_in_days=None, custom_headers=None, raw=False, **operation_config): + """Updates a Log Analytics workspace table properties. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param table_name: The name of the table. + :type table_name: str + :param retention_in_days: The data table data retention in days, + between 30 and 730. Setting this property to null will default to the + workspace retention. + :type retention_in_days: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Table or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.loganalytics.models.Table or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorContractException` + """ + parameters = models.Table(retention_in_days=retention_in_days) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=63, min_length=4, pattern=r'^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Table') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorContractException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}'} + + def get( + self, resource_group_name, workspace_name, table_name, custom_headers=None, raw=False, **operation_config): + """Gets a Log Analytics workspace table. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param table_name: The name of the table. + :type table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Table or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.loganalytics.models.Table or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorContractException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=63, min_length=4, pattern=r'^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'), + 'tableName': self._serialize.url("table_name", table_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorContractException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Table', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}'} diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_workspaces_operations.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_workspaces_operations.py index 2c850d57d69e..b61fe9744927 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_workspaces_operations.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_workspaces_operations.py @@ -283,7 +283,7 @@ def get_long_running_output(response): def _delete_initial( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, workspace_name, force=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -296,6 +296,8 @@ def _delete_initial( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') # Construct headers header_parameters = {} @@ -320,14 +322,21 @@ def _delete_initial( return client_raw_response def delete( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a workspace instance. + self, resource_group_name, workspace_name, force=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a workspace resource. To recover the workspace, create it again + with the same name, in the same subscription, resource group and + location. The name is kept for 14 days and cannot be used for another + workspace. To remove the workspace completely and release the name, use + the force flag. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str + :param force: Deletes the workspace without the recovery option. A + workspace that was deleted with this flag cannot be recovered. + :type force: bool :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response @@ -342,6 +351,7 @@ def delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, + force=force, custom_headers=custom_headers, raw=True, **operation_config @@ -490,65 +500,3 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'} - - def available_service_tiers( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): - """Gets the available service tiers for the workspace. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param workspace_name: The name of the workspace. - :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.loganalytics.models.AvailableServiceTier] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.available_service_tiers.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=63, min_length=4, pattern=r'^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[AvailableServiceTier]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - available_service_tiers.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers'} diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/setup.py b/sdk/loganalytics/azure-mgmt-loganalytics/setup.py index eea54942f3e7..ce8f42ec38f5 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/setup.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) From 951986b01338a9816f65b7da268b5e1ba3209480 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 27 May 2020 20:59:06 +0000 Subject: [PATCH 2/2] Generated from fc3a4f33a3ae7ea66c76d4384d278e4631344cd7 v1 --- .../azure/mgmt/loganalytics/models/_models.py | 12 ++++++------ .../azure/mgmt/loganalytics/models/_models_py3.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py index 61269424b641..1b6ac875eec5 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models.py @@ -39,7 +39,7 @@ class AvailableServiceTier(Model): :vartype capacity_reservation_level: long :ivar last_sku_update: Time when the sku was last updated for the workspace. Returned for the Capacity Reservation Service Tier. - :vartype last_sku_update: str + :vartype last_sku_update: datetime """ _validation = { @@ -59,7 +59,7 @@ class AvailableServiceTier(Model): 'maximum_retention': {'key': 'maximumRetention', 'type': 'long'}, 'default_retention': {'key': 'defaultRetention', 'type': 'long'}, 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'long'}, - 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'iso-8601'}, } def __init__(self, **kwargs): @@ -1697,7 +1697,7 @@ class WorkspaceCapping(Model): unlimited. :type daily_quota_gb: float :ivar quota_next_reset_time: The time when the quota will be rest. - :vartype quota_next_reset_time: str + :vartype quota_next_reset_time: datetime :ivar data_ingestion_status: The status of data ingestion for this workspace. Possible values include: 'RespectQuota', 'ForceOn', 'ForceOff', 'OverQuota', 'SubscriptionSuspended', 'ApproachingQuota' @@ -1712,7 +1712,7 @@ class WorkspaceCapping(Model): _attribute_map = { 'daily_quota_gb': {'key': 'dailyQuotaGb', 'type': 'float'}, - 'quota_next_reset_time': {'key': 'quotaNextResetTime', 'type': 'str'}, + 'quota_next_reset_time': {'key': 'quotaNextResetTime', 'type': 'iso-8601'}, 'data_ingestion_status': {'key': 'dataIngestionStatus', 'type': 'str'}, } @@ -1941,7 +1941,7 @@ class WorkspaceSku(Model): selected. :vartype max_capacity_reservation_level: int :ivar last_sku_update: The last time when the sku was updated. - :vartype last_sku_update: str + :vartype last_sku_update: datetime """ _validation = { @@ -1954,7 +1954,7 @@ class WorkspaceSku(Model): 'name': {'key': 'name', 'type': 'str'}, 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'int'}, 'max_capacity_reservation_level': {'key': 'maxCapacityReservationLevel', 'type': 'int'}, - 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'iso-8601'}, } def __init__(self, **kwargs): diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py index 6640ff898a3e..7cf9b6eccd05 100644 --- a/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py +++ b/sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/_models_py3.py @@ -39,7 +39,7 @@ class AvailableServiceTier(Model): :vartype capacity_reservation_level: long :ivar last_sku_update: Time when the sku was last updated for the workspace. Returned for the Capacity Reservation Service Tier. - :vartype last_sku_update: str + :vartype last_sku_update: datetime """ _validation = { @@ -59,7 +59,7 @@ class AvailableServiceTier(Model): 'maximum_retention': {'key': 'maximumRetention', 'type': 'long'}, 'default_retention': {'key': 'defaultRetention', 'type': 'long'}, 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'long'}, - 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'iso-8601'}, } def __init__(self, **kwargs) -> None: @@ -1697,7 +1697,7 @@ class WorkspaceCapping(Model): unlimited. :type daily_quota_gb: float :ivar quota_next_reset_time: The time when the quota will be rest. - :vartype quota_next_reset_time: str + :vartype quota_next_reset_time: datetime :ivar data_ingestion_status: The status of data ingestion for this workspace. Possible values include: 'RespectQuota', 'ForceOn', 'ForceOff', 'OverQuota', 'SubscriptionSuspended', 'ApproachingQuota' @@ -1712,7 +1712,7 @@ class WorkspaceCapping(Model): _attribute_map = { 'daily_quota_gb': {'key': 'dailyQuotaGb', 'type': 'float'}, - 'quota_next_reset_time': {'key': 'quotaNextResetTime', 'type': 'str'}, + 'quota_next_reset_time': {'key': 'quotaNextResetTime', 'type': 'iso-8601'}, 'data_ingestion_status': {'key': 'dataIngestionStatus', 'type': 'str'}, } @@ -1941,7 +1941,7 @@ class WorkspaceSku(Model): selected. :vartype max_capacity_reservation_level: int :ivar last_sku_update: The last time when the sku was updated. - :vartype last_sku_update: str + :vartype last_sku_update: datetime """ _validation = { @@ -1954,7 +1954,7 @@ class WorkspaceSku(Model): 'name': {'key': 'name', 'type': 'str'}, 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'int'}, 'max_capacity_reservation_level': {'key': 'maxCapacityReservationLevel', 'type': 'int'}, - 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'str'}, + 'last_sku_update': {'key': 'lastSkuUpdate', 'type': 'iso-8601'}, } def __init__(self, *, name, capacity_reservation_level: int=None, **kwargs) -> None: