Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions sdk/monitor/azure-mgmt-monitor/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"commit": "a86a97dd03e0b9e692b5583e369feec3a579ef55",
"commit": "27a6a18feb693251ea80d1894f77fe8c0fdce06a",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.10.2",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/monitor/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-python-sdk-for-cli-only --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
"readme": "specification/monitor/resource-manager/readme.md"
"typespec_src": "specification/monitor/Microsoft.Monitor.Management",
"@azure-tools/typespec-python": "0.39.1"
}
77 changes: 77 additions & 0 deletions sdk/monitor/azure-mgmt-monitor/apiview-properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"CrossLanguagePackageId": "Microsoft.Monitor",
"CrossLanguageDefinitionId": {
"azure.mgmt.monitor.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
"azure.mgmt.monitor.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
"azure.mgmt.monitor.models.AzureMonitorWorkspace": "Microsoft.Monitor.AzureMonitorWorkspace",
"azure.mgmt.monitor.models.AzureMonitorWorkspaceLogsApiConfig": "Microsoft.Monitor.AzureMonitorWorkspaceLogsApiConfig",
"azure.mgmt.monitor.models.AzureMonitorWorkspaceLogsExporter": "Microsoft.Monitor.AzureMonitorWorkspaceLogsExporter",
"azure.mgmt.monitor.models.AzureMonitorWorkspaceProperties": "Microsoft.Monitor.AzureMonitorWorkspaceProperties",
"azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel",
"azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties",
"azure.mgmt.monitor.models.BatchProcessor": "Microsoft.Monitor.BatchProcessor",
"azure.mgmt.monitor.models.CacheConfiguration": "Microsoft.Monitor.CacheConfiguration",
"azure.mgmt.monitor.models.ConcurrencyConfiguration": "Microsoft.Monitor.ConcurrencyConfiguration",
"azure.mgmt.monitor.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
"azure.mgmt.monitor.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
"azure.mgmt.monitor.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
"azure.mgmt.monitor.models.Exporter": "Microsoft.Monitor.Exporter",
"azure.mgmt.monitor.models.ExtendedLocation": "Azure.ResourceManager.CommonTypes.ExtendedLocation",
"azure.mgmt.monitor.models.IngestionSettings": "Microsoft.Monitor.IngestionSettings",
"azure.mgmt.monitor.models.Metrics": "Microsoft.Monitor.Metrics",
"azure.mgmt.monitor.models.NetworkingConfiguration": "Microsoft.Monitor.NetworkingConfiguration",
"azure.mgmt.monitor.models.NetworkingRoute": "Microsoft.Monitor.NetworkingRoute",
"azure.mgmt.monitor.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
"azure.mgmt.monitor.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
"azure.mgmt.monitor.models.OtlpReceiver": "Microsoft.Monitor.OtlpReceiver",
"azure.mgmt.monitor.models.PersistenceConfigurations": "Microsoft.Monitor.PersistenceConfigurations",
"azure.mgmt.monitor.models.Pipeline": "Microsoft.Monitor.Pipeline",
"azure.mgmt.monitor.models.PipelineGroup": "Microsoft.Monitor.PipelineGroup",
"azure.mgmt.monitor.models.PipelineGroupProperties": "Microsoft.Monitor.PipelineGroupProperties",
"azure.mgmt.monitor.models.PipelineGroupUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel",
"azure.mgmt.monitor.models.PipelineGroupUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties",
"azure.mgmt.monitor.models.PrivateEndpoint": "Azure.ResourceManager.CommonTypes.PrivateEndpoint",
"azure.mgmt.monitor.models.PrivateEndpointConnection": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnection",
"azure.mgmt.monitor.models.PrivateEndpointConnectionProperties": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties",
"azure.mgmt.monitor.models.PrivateLinkServiceConnectionState": "Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState",
"azure.mgmt.monitor.models.Processor": "Microsoft.Monitor.Processor",
"azure.mgmt.monitor.models.Receiver": "Microsoft.Monitor.Receiver",
"azure.mgmt.monitor.models.RecordMap": "Microsoft.Monitor.RecordMap",
"azure.mgmt.monitor.models.ResourceMap": "Microsoft.Monitor.ResourceMap",
"azure.mgmt.monitor.models.SchemaMap": "Microsoft.Monitor.SchemaMap",
"azure.mgmt.monitor.models.ScopeMap": "Microsoft.Monitor.ScopeMap",
"azure.mgmt.monitor.models.Service": "Microsoft.Monitor.Service",
"azure.mgmt.monitor.models.SyslogReceiver": "Microsoft.Monitor.SyslogReceiver",
"azure.mgmt.monitor.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
"azure.mgmt.monitor.models.TcpExporter": "Microsoft.Monitor.TcpExporter",
"azure.mgmt.monitor.models.UdpReceiver": "Microsoft.Monitor.UdpReceiver",
"azure.mgmt.monitor.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
"azure.mgmt.monitor.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
"azure.mgmt.monitor.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
"azure.mgmt.monitor.models.ProvisioningState": "Microsoft.Monitor.ProvisioningState",
"azure.mgmt.monitor.models.PrivateEndpointServiceConnectionStatus": "Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus",
"azure.mgmt.monitor.models.PrivateEndpointConnectionProvisioningState": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState",
"azure.mgmt.monitor.models.PublicNetworkAccess": "Microsoft.Monitor.PublicNetworkAccess",
"azure.mgmt.monitor.models.ReceiverType": "Microsoft.Monitor.ReceiverType",
"azure.mgmt.monitor.models.SyslogProtocol": "Microsoft.Monitor.SyslogProtocol",
"azure.mgmt.monitor.models.StreamEncodingType": "Microsoft.Monitor.StreamEncodingType",
"azure.mgmt.monitor.models.ProcessorType": "Microsoft.Monitor.ProcessorType",
"azure.mgmt.monitor.models.ExporterType": "Microsoft.Monitor.ExporterType",
"azure.mgmt.monitor.models.PipelineType": "Microsoft.Monitor.PipelineType",
"azure.mgmt.monitor.models.ExternalNetworkingMode": "Microsoft.Monitor.ExternalNetworkingMode",
"azure.mgmt.monitor.models.ExtendedLocationType": "Azure.ResourceManager.CommonTypes.ExtendedLocationType",
"azure.mgmt.monitor.MonitorManagementClient.operations.list": "Azure.ResourceManager.Operations.list",
"azure.mgmt.monitor.MonitorManagementClient.azure_monitor_workspaces.get": "Microsoft.Monitor.AzureMonitorWorkspaces.get",
"azure.mgmt.monitor.MonitorManagementClient.azure_monitor_workspaces.begin_create_or_update": "Microsoft.Monitor.AzureMonitorWorkspaces.createOrUpdate",
"azure.mgmt.monitor.MonitorManagementClient.azure_monitor_workspaces.update": "Microsoft.Monitor.AzureMonitorWorkspaces.update",
"azure.mgmt.monitor.MonitorManagementClient.azure_monitor_workspaces.begin_delete": "Microsoft.Monitor.AzureMonitorWorkspaces.delete",
"azure.mgmt.monitor.MonitorManagementClient.azure_monitor_workspaces.list_by_resource_group": "Microsoft.Monitor.AzureMonitorWorkspaces.listByResourceGroup",
"azure.mgmt.monitor.MonitorManagementClient.azure_monitor_workspaces.list_by_subscription": "Microsoft.Monitor.AzureMonitorWorkspaces.listBySubscription",
"azure.mgmt.monitor.MonitorManagementClient.pipeline_groups.get": "Microsoft.Monitor.PipelineGroups.get",
"azure.mgmt.monitor.MonitorManagementClient.pipeline_groups.begin_create_or_update": "Microsoft.Monitor.PipelineGroups.createOrUpdate",
"azure.mgmt.monitor.MonitorManagementClient.pipeline_groups.begin_delete": "Microsoft.Monitor.PipelineGroups.delete",
"azure.mgmt.monitor.MonitorManagementClient.pipeline_groups.begin_update": "Microsoft.Monitor.PipelineGroups.update",
"azure.mgmt.monitor.MonitorManagementClient.pipeline_groups.list_by_resource_group": "Microsoft.Monitor.PipelineGroups.listByResourceGroup",
"azure.mgmt.monitor.MonitorManagementClient.pipeline_groups.list_by_subscription": "Microsoft.Monitor.PipelineGroups.listBySubscription"
}
}
4 changes: 2 additions & 2 deletions sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position
Expand All @@ -12,7 +12,7 @@
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._monitor_management_client import MonitorManagementClient # type: ignore
from ._client import MonitorManagementClient # type: ignore
from ._version import VERSION

__version__ = VERSION
Expand Down
124 changes: 124 additions & 0 deletions sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self

from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy

from ._configuration import MonitorManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import AzureMonitorWorkspacesOperations, Operations, PipelineGroupsOperations

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential


class MonitorManagementClient:
"""Provides operations for working with Azure Monitor.

:ivar operations: Operations operations
:vartype operations: azure.mgmt.monitor.operations.Operations
:ivar azure_monitor_workspaces: AzureMonitorWorkspacesOperations operations
:vartype azure_monitor_workspaces:
azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations
:ivar pipeline_groups: PipelineGroupsOperations operations
:vartype pipeline_groups: azure.mgmt.monitor.operations.PipelineGroupsOperations
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: The API version to use for this operation. Default value is
"2023-10-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""

def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = MonitorManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
ARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.azure_monitor_workspaces = AzureMonitorWorkspacesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.pipeline_groups = PipelineGroupsOperations(self._client, self._config, self._serialize, self._deserialize)

def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

request_copy = deepcopy(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore

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

def __enter__(self) -> Self:
self._client.__enter__()
return self

def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# --------------------------------------------------------------------------
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand All @@ -23,20 +23,36 @@ class MonitorManagementClientConfiguration: # pylint: disable=too-many-instance
Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure. Required.
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: The API version to use for this operation. Default value is
"2023-10-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")

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.")

self.credential = credential
self.subscription_id = subscription_id
self.base_url = base_url
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-monitor/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Loading