Skip to content

Commit

Permalink
CodeGen from PR 32741 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 88de974f8bc73ef73076d2c3dda0b90d47aaf6ed into bbdbd8545dedd6436b8e30efe45270367389a9b6
  • Loading branch information
SDKAuto committed Feb 21, 2025
1 parent b27efc9 commit 91433b2
Show file tree
Hide file tree
Showing 79 changed files with 11,771 additions and 9,787 deletions.
11 changes: 3 additions & 8 deletions sdk/chaos/azure-mgmt-chaos/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"commit": "50f502f5099796ba92f63384884574d46333cec2",
"commit": "6e6db839a67d5a55473c25b848644ffef5ea1980",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/chaos/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"readme": "specification/chaos/resource-manager/readme.md"
"typespec_src": "specification/chaos/Chaos.Management",
"@azure-tools/typespec-python": "0.38.4"
}
87 changes: 87 additions & 0 deletions sdk/chaos/azure-mgmt-chaos/apiview-properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"CrossLanguagePackageId": "Microsoft.Chaos",
"CrossLanguageDefinitionId": {
"azure.mgmt.chaos.models.ActionStatus": "Microsoft.Chaos.ActionStatus",
"azure.mgmt.chaos.models.BranchStatus": "Microsoft.Chaos.BranchStatus",
"azure.mgmt.chaos.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
"azure.mgmt.chaos.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource",
"azure.mgmt.chaos.models.Capability": "Microsoft.Chaos.Capability",
"azure.mgmt.chaos.models.CapabilityProperties": "Microsoft.Chaos.CapabilityProperties",
"azure.mgmt.chaos.models.CapabilityType": "Microsoft.Chaos.CapabilityType",
"azure.mgmt.chaos.models.CapabilityTypeProperties": "Microsoft.Chaos.CapabilityTypeProperties",
"azure.mgmt.chaos.models.CapabilityTypePropertiesRuntimeProperties": "Microsoft.Chaos.CapabilityTypePropertiesRuntimeProperties",
"azure.mgmt.chaos.models.ChaosExperimentAction": "Microsoft.Chaos.ChaosExperimentAction",
"azure.mgmt.chaos.models.ChaosExperimentBranch": "Microsoft.Chaos.ChaosExperimentBranch",
"azure.mgmt.chaos.models.ChaosExperimentStep": "Microsoft.Chaos.ChaosExperimentStep",
"azure.mgmt.chaos.models.ChaosTargetFilter": "Microsoft.Chaos.ChaosTargetFilter",
"azure.mgmt.chaos.models.ChaosTargetSelector": "Microsoft.Chaos.ChaosTargetSelector",
"azure.mgmt.chaos.models.ChaosTargetListSelector": "Microsoft.Chaos.ChaosTargetListSelector",
"azure.mgmt.chaos.models.ChaosTargetQuerySelector": "Microsoft.Chaos.ChaosTargetQuerySelector",
"azure.mgmt.chaos.models.ChaosTargetSimpleFilter": "Microsoft.Chaos.ChaosTargetSimpleFilter",
"azure.mgmt.chaos.models.ChaosTargetSimpleFilterParameters": "Microsoft.Chaos.ChaosTargetSimpleFilterParameters",
"azure.mgmt.chaos.models.ContinuousAction": "Microsoft.Chaos.ContinuousAction",
"azure.mgmt.chaos.models.DelayAction": "Microsoft.Chaos.DelayAction",
"azure.mgmt.chaos.models.DiscreteAction": "Microsoft.Chaos.DiscreteAction",
"azure.mgmt.chaos.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
"azure.mgmt.chaos.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
"azure.mgmt.chaos.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
"azure.mgmt.chaos.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
"azure.mgmt.chaos.models.Experiment": "Microsoft.Chaos.Experiment",
"azure.mgmt.chaos.models.ExperimentExecution": "Microsoft.Chaos.ExperimentExecution",
"azure.mgmt.chaos.models.ExperimentExecutionActionTargetDetailsError": "Microsoft.Chaos.ExperimentExecutionActionTargetDetailsError",
"azure.mgmt.chaos.models.ExperimentExecutionActionTargetDetailsProperties": "Microsoft.Chaos.ExperimentExecutionActionTargetDetailsProperties",
"azure.mgmt.chaos.models.ExperimentExecutionDetails": "Microsoft.Chaos.ExperimentExecutionDetails",
"azure.mgmt.chaos.models.ExperimentExecutionDetailsProperties": "Microsoft.Chaos.ExperimentExecutionDetailsProperties",
"azure.mgmt.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation": "Microsoft.Chaos.ExperimentExecutionDetailsPropertiesRunInformation",
"azure.mgmt.chaos.models.ExperimentExecutionProperties": "Microsoft.Chaos.ExperimentExecutionProperties",
"azure.mgmt.chaos.models.ExperimentProperties": "Microsoft.Chaos.ExperimentProperties",
"azure.mgmt.chaos.models.ExperimentUpdate": "Microsoft.Chaos.ExperimentUpdate",
"azure.mgmt.chaos.models.KeyValuePair": "Microsoft.Chaos.KeyValuePair",
"azure.mgmt.chaos.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity",
"azure.mgmt.chaos.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
"azure.mgmt.chaos.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
"azure.mgmt.chaos.models.OperationStatus": "Microsoft.Chaos.OperationStatus",
"azure.mgmt.chaos.models.OperationStatusResult": "Azure.ResourceManager.CommonTypes.OperationStatusResult",
"azure.mgmt.chaos.models.StepStatus": "Microsoft.Chaos.StepStatus",
"azure.mgmt.chaos.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
"azure.mgmt.chaos.models.Target": "Microsoft.Chaos.Target",
"azure.mgmt.chaos.models.TargetReference": "Microsoft.Chaos.TargetReference",
"azure.mgmt.chaos.models.TargetType": "Microsoft.Chaos.TargetType",
"azure.mgmt.chaos.models.TargetTypeProperties": "Microsoft.Chaos.TargetTypeProperties",
"azure.mgmt.chaos.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity",
"azure.mgmt.chaos.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
"azure.mgmt.chaos.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
"azure.mgmt.chaos.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
"azure.mgmt.chaos.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType",
"azure.mgmt.chaos.models.ProvisioningState": "Microsoft.Chaos.ProvisioningState",
"azure.mgmt.chaos.models.ExperimentActionType": "Microsoft.Chaos.ExperimentActionType",
"azure.mgmt.chaos.models.SelectorType": "Microsoft.Chaos.SelectorType",
"azure.mgmt.chaos.models.FilterType": "Microsoft.Chaos.FilterType",
"azure.mgmt.chaos.models.TargetReferenceType": "Microsoft.Chaos.TargetReferenceType",
"azure.mgmt.chaos.ChaosManagementClient.capabilities.get": "Microsoft.Chaos.Capabilities.get",
"azure.mgmt.chaos.ChaosManagementClient.capabilities.create_or_update": "Microsoft.Chaos.Capabilities.createOrUpdate",
"azure.mgmt.chaos.ChaosManagementClient.capabilities.delete": "Microsoft.Chaos.Capabilities.delete",
"azure.mgmt.chaos.ChaosManagementClient.capabilities.list": "Microsoft.Chaos.Capabilities.list",
"azure.mgmt.chaos.ChaosManagementClient.operations.list": "Azure.ResourceManager.Operations.list",
"azure.mgmt.chaos.ChaosManagementClient.targets.get": "Microsoft.Chaos.Targets.get",
"azure.mgmt.chaos.ChaosManagementClient.targets.create_or_update": "Microsoft.Chaos.Targets.createOrUpdate",
"azure.mgmt.chaos.ChaosManagementClient.targets.delete": "Microsoft.Chaos.Targets.delete",
"azure.mgmt.chaos.ChaosManagementClient.targets.list": "Microsoft.Chaos.Targets.list",
"azure.mgmt.chaos.ChaosManagementClient.capability_types.get": "Microsoft.Chaos.CapabilityTypes.get",
"azure.mgmt.chaos.ChaosManagementClient.capability_types.list": "Microsoft.Chaos.CapabilityTypes.list",
"azure.mgmt.chaos.ChaosManagementClient.experiments.get": "Microsoft.Chaos.Experiments.get",
"azure.mgmt.chaos.ChaosManagementClient.experiments.begin_create_or_update": "Microsoft.Chaos.Experiments.createOrUpdate",
"azure.mgmt.chaos.ChaosManagementClient.experiments.begin_update": "Microsoft.Chaos.Experiments.update",
"azure.mgmt.chaos.ChaosManagementClient.experiments.begin_delete": "Microsoft.Chaos.Experiments.delete",
"azure.mgmt.chaos.ChaosManagementClient.experiments.list": "Microsoft.Chaos.Experiments.list",
"azure.mgmt.chaos.ChaosManagementClient.experiments.list_all": "Microsoft.Chaos.Experiments.listAll",
"azure.mgmt.chaos.ChaosManagementClient.experiments.begin_cancel": "Microsoft.Chaos.Experiments.cancel",
"azure.mgmt.chaos.ChaosManagementClient.experiments.begin_start": "Microsoft.Chaos.Experiments.start",
"azure.mgmt.chaos.ChaosManagementClient.experiment_executions.get_execution": "Microsoft.Chaos.ExperimentExecutions.getExecution",
"azure.mgmt.chaos.ChaosManagementClient.experiment_executions.list_all_executions": "Microsoft.Chaos.ExperimentExecutions.listAllExecutions",
"azure.mgmt.chaos.ChaosManagementClient.experiment_executions.get_execution_details": "Microsoft.Chaos.ExperimentExecutions.getExecutionDetails",
"azure.mgmt.chaos.ChaosManagementClient.target_types.get": "Microsoft.Chaos.TargetTypes.get",
"azure.mgmt.chaos.ChaosManagementClient.target_types.list": "Microsoft.Chaos.TargetTypes.list",
"azure.mgmt.chaos.ChaosManagementClient.operation_statuses.get": "Microsoft.Chaos.OperationStatuses.get"
}
}
14 changes: 10 additions & 4 deletions sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@
# --------------------------------------------------------------------------
# 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

from ._chaos_management_client import ChaosManagementClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import ChaosManagementClient # type: ignore
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ChaosManagementClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

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 . import models as _models
from ._configuration import ChaosManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
CapabilitiesOperations,
CapabilityTypesOperations,
ExperimentExecutionsOperations,
ExperimentsOperations,
OperationStatusesOperations,
Operations,
Expand All @@ -26,35 +29,36 @@
)

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class ChaosManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
class ChaosManagementClient: # pylint: disable=too-many-instance-attributes
"""Chaos Management Client.
:ivar capabilities: CapabilitiesOperations operations
:vartype capabilities: azure.mgmt.chaos.operations.CapabilitiesOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.chaos.operations.Operations
:ivar targets: TargetsOperations operations
:vartype targets: azure.mgmt.chaos.operations.TargetsOperations
:ivar capability_types: CapabilityTypesOperations operations
:vartype capability_types: azure.mgmt.chaos.operations.CapabilityTypesOperations
:ivar experiments: ExperimentsOperations operations
:vartype experiments: azure.mgmt.chaos.operations.ExperimentsOperations
:ivar operation_statuses: OperationStatusesOperations operations
:vartype operation_statuses: azure.mgmt.chaos.operations.OperationStatusesOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.chaos.operations.Operations
:ivar experiment_executions: ExperimentExecutionsOperations operations
:vartype experiment_executions: azure.mgmt.chaos.operations.ExperimentExecutionsOperations
:ivar target_types: TargetTypesOperations operations
:vartype target_types: azure.mgmt.chaos.operations.TargetTypesOperations
:ivar targets: TargetsOperations operations
:vartype targets: azure.mgmt.chaos.operations.TargetsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:ivar operation_statuses: OperationStatusesOperations operations
:vartype operation_statuses: azure.mgmt.chaos.operations.OperationStatusesOperations
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: GUID that represents an Azure subscription ID. 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 URL. Default value is "https://management.azure.com".
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Default value is "2025-01-01".
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.
Expand All @@ -67,34 +71,55 @@ def __init__(
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = ChaosManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
_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.capabilities = CapabilitiesOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
self.capability_types = CapabilityTypesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operation_statuses = OperationStatusesOperations(
self.experiment_executions = ExperimentExecutionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.target_types = TargetTypesOperations(self._client, self._config, self._serialize, self._deserialize)
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operation_statuses = OperationStatusesOperations(
self._client, self._config, self._serialize, self._deserialize
)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
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)
>>> response = client.send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
Expand All @@ -107,13 +132,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
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) -> "ChaosManagementClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down
Loading

0 comments on commit 91433b2

Please sign in to comment.