diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md index e32da47c70f6..b8b36f288c09 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md @@ -1,5 +1,46 @@ # Release History +## 1.1.0b1 (2026-07-23) + +### Features Added + + - Client `DevOpsInfrastructureMgmtClient` added parameter `cloud_setting` in method `__init__` + - Model `AzureDevOpsOrganizationProfile` added property `description` + - Model `AzureDevOpsOrganizationProfile` added property `update_description` + - Model `AzureDevOpsOrganizationProfile` added property `alias` + - Model `DevOpsAzureSku` added property `windows_nvme_drive` + - Model `DevOpsAzureSku` added property `linux_nvme_path` + - Model `DevOpsAzureSku` added property `vm_sizes` + - Model `NetworkProfile` added property `static_ip_address_count` + - Model `NetworkProfile` added property `ip_addresses` + - Model `Organization` added property `open_access` + - Model `Organization` added property `alias` + - Model `PoolImage` added property `ephemeral_type` + - Model `PoolImage` added property `is_ephemeral` + - Model `PoolImage` added property `provisioning_script_storage_account_resource_id` + - Model `PoolImage` added property `provisioning_script_managed_identity_client_id` + - Model `PoolImage` added property `provisioning_script_should_restart` + - Model `PoolImage` added property `provisioning_script_entry_point` + - Model `PoolProperties` added property `runtime_configuration` + - Model `PoolUpdateProperties` added property `runtime_configuration` + - Model `SecretsManagementSettings` added property `certificate_store_name` + - Added enum `ActionType` + - Added enum `AvailabilityStatus` + - Added enum `CertificateStoreNameOption` + - Added model `CheckNameAvailability` + - Added enum `CheckNameAvailabilityReason` + - Added model `CheckNameAvailabilityResult` + - Added model `DeleteResourcesDetails` + - Added enum `DevOpsInfrastructureResourceType` + - Added enum `EphemeralType` + - Added model `Operation` + - Added model `OperationDisplay` + - Added enum `Origin` + - Added model `RuntimeConfiguration` + - Added model `VmSize` + - Operation group `PoolsOperations` added method `check_name_availability` + - Operation group `PoolsOperations` added method `delete_resources` + ## 1.0.0 (2024-11-21) ### Features Added diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in index 644150fb3a27..69542634f3d2 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/devopsinfrastructure/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md index bbd44b827115..bd2435c5dd19 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Devopsinfrastructure Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.10+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.10+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Microsoft Entra](https://learn.microsoft.com/entra/fundamentals/what-is-entra) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json deleted file mode 100644 index ed41f8389e46..000000000000 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "commit": "95e89f00932d2a8f04ff80e28f8ce10ee586ca7d", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "typespec_src": "specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management", - "@azure-tools/typespec-python": "0.36.0" -} \ No newline at end of file diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_metadata.json b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_metadata.json new file mode 100644 index 000000000000..80113a8ca6f1 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_metadata.json @@ -0,0 +1,11 @@ +{ + "apiVersion": "2026-07-03-preview", + "apiVersions": { + "Microsoft.DevOpsInfrastructure": "2026-07-03-preview" + }, + "commit": "0e55128a206a1be3feb030e748074722e98e5dcf", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/DevOpsInfrastructure", + "emitterVersion": "0.63.3", + "httpClientPythonVersion": "^0.34.2" +} \ No newline at end of file diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/api.md b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/api.md new file mode 100644 index 000000000000..a067e82fb01f --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/api.md @@ -0,0 +1,1944 @@ +```py +namespace azure.mgmt.devopsinfrastructure + + class azure.mgmt.devopsinfrastructure.DevOpsInfrastructureMgmtClient: implements ContextManager + image_versions: ImageVersionsOperations + operations: Operations + pools: PoolsOperations + resource_details: ResourceDetailsOperations + sku: SkuOperations + subscription_usages: SubscriptionUsagesOperations + + def __init__( + self, + credential: TokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> HttpResponse: ... + + +namespace azure.mgmt.devopsinfrastructure.aio + + class azure.mgmt.devopsinfrastructure.aio.DevOpsInfrastructureMgmtClient: implements AsyncContextManager + image_versions: ImageVersionsOperations + operations: Operations + pools: PoolsOperations + resource_details: ResourceDetailsOperations + sku: SkuOperations + subscription_usages: SubscriptionUsagesOperations + + def __init__( + self, + credential: AsyncTokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + async def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: ... + + +namespace azure.mgmt.devopsinfrastructure.aio.operations + + class azure.mgmt.devopsinfrastructure.aio.operations.ImageVersionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_image( + self, + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ImageVersion]: ... + + + class azure.mgmt.devopsinfrastructure.aio.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[Operation]: ... + + + class azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Pool]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Pool]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Pool]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + pool_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Pool]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Pool]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Pool]: ... + + @overload + async def check_name_availability( + self, + body: CheckNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + async def check_name_availability( + self, + body: CheckNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + async def check_name_availability( + self, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + pool_name: str, + **kwargs: Any + ) -> Pool: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[Pool]: ... + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged[Pool]: ... + + + class azure.mgmt.devopsinfrastructure.aio.operations.ResourceDetailsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_pool( + self, + resource_group_name: str, + pool_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ResourceDetailsObject]: ... + + + class azure.mgmt.devopsinfrastructure.aio.operations.SkuOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_location( + self, + location_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ResourceSku]: ... + + + class azure.mgmt.devopsinfrastructure.aio.operations.SubscriptionUsagesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def usages( + self, + location: str, + **kwargs: Any + ) -> AsyncItemPaged[Quota]: ... + + +namespace azure.mgmt.devopsinfrastructure.models + + class azure.mgmt.devopsinfrastructure.models.ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INTERNAL = "Internal" + + + class azure.mgmt.devopsinfrastructure.models.AgentProfile(_Model): + kind: str + resource_predictions: Optional[ResourcePredictions] + resource_predictions_profile: Optional[ResourcePredictionsProfile] + + @overload + def __init__( + self, + *, + kind: str, + resource_predictions: Optional[ResourcePredictions] = ..., + resource_predictions_profile: Optional[ResourcePredictionsProfile] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.AutomaticResourcePredictionsProfile(ResourcePredictionsProfile, discriminator='Automatic'): + kind: Literal[ResourcePredictionsProfileType.AUTOMATIC] + prediction_preference: Optional[Union[str, PredictionPreference]] + + @overload + def __init__( + self, + *, + prediction_preference: Optional[Union[str, PredictionPreference]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.AvailabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AVAILABLE = "Available" + UNAVAILABLE = "Unavailable" + + + class azure.mgmt.devopsinfrastructure.models.AzureDevOpsOrganizationProfile(OrganizationProfile, discriminator='AzureDevOps'): + alias: Optional[str] + description: Optional[str] + kind: Literal["AzureDevOps"] + organizations: list[Organization] + permission_profile: Optional[AzureDevOpsPermissionProfile] + update_description: Optional[bool] + + @overload + def __init__( + self, + *, + alias: Optional[str] = ..., + description: Optional[str] = ..., + organizations: list[Organization], + permission_profile: Optional[AzureDevOpsPermissionProfile] = ..., + update_description: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionProfile(_Model): + groups: Optional[list[str]] + kind: Union[str, AzureDevOpsPermissionType] + users: Optional[list[str]] + + @overload + def __init__( + self, + *, + groups: Optional[list[str]] = ..., + kind: Union[str, AzureDevOpsPermissionType], + users: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CREATOR_ONLY = "CreatorOnly" + INHERIT = "Inherit" + SPECIFIC_ACCOUNTS = "SpecificAccounts" + + + class azure.mgmt.devopsinfrastructure.models.CachingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + + + class azure.mgmt.devopsinfrastructure.models.CertificateStoreNameOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MY = "My" + ROOT = "Root" + + + class azure.mgmt.devopsinfrastructure.models.CheckNameAvailability(_Model): + name: str + type: Union[str, DevOpsInfrastructureResourceType] + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, DevOpsInfrastructureResourceType] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALREADY_EXISTS = "AlreadyExists" + INVALID = "Invalid" + + + class azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult(_Model): + available: Union[str, AvailabilityStatus] + message: str + name: str + reason: Union[str, CheckNameAvailabilityReason] + + @overload + def __init__( + self, + *, + available: Union[str, AvailabilityStatus], + message: str, + name: str, + reason: Union[str, CheckNameAvailabilityReason] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" + KEY = "Key" + MANAGED_IDENTITY = "ManagedIdentity" + USER = "User" + + + class azure.mgmt.devopsinfrastructure.models.DataDisk(_Model): + caching: Optional[Union[str, CachingType]] + disk_size_gi_b: Optional[int] + drive_letter: Optional[str] + storage_account_type: Optional[Union[str, StorageAccountType]] + + @overload + def __init__( + self, + *, + caching: Optional[Union[str, CachingType]] = ..., + disk_size_gi_b: Optional[int] = ..., + drive_letter: Optional[str] = ..., + storage_account_type: Optional[Union[str, StorageAccountType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.DeleteResourcesDetails(_Model): + resource_ids: list[str] + + @overload + def __init__( + self, + *, + resource_ids: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.DevOpsAzureSku(_Model): + linux_nvme_path: Optional[str] + name: str + vm_sizes: Optional[list[VmSize]] + windows_nvme_drive: Optional[str] + + @overload + def __init__( + self, + *, + linux_nvme_path: Optional[str] = ..., + name: str, + vm_sizes: Optional[list[VmSize]] = ..., + windows_nvme_drive: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.DevOpsInfrastructureResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MICROSOFT_DEV_OPS_INFRASTRUCTURE_POOLS = "Microsoft.DevOpsInfrastructure/pools" + + + class azure.mgmt.devopsinfrastructure.models.EphemeralType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTOMATIC = "Automatic" + CACHE_DISK = "CacheDisk" + NV_ME_DISK = "NVMeDisk" + RESOURCE_DISK = "ResourceDisk" + + + class azure.mgmt.devopsinfrastructure.models.ErrorAdditionalInfo(_Model): + info: Optional[Any] + type: Optional[str] + + + class azure.mgmt.devopsinfrastructure.models.ErrorDetail(_Model): + additional_info: Optional[list[ErrorAdditionalInfo]] + code: Optional[str] + details: Optional[list[ErrorDetail]] + message: Optional[str] + target: Optional[str] + + + class azure.mgmt.devopsinfrastructure.models.ErrorResponse(_Model): + error: Optional[ErrorDetail] + + @overload + def __init__( + self, + *, + error: Optional[ErrorDetail] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.FabricProfile(_Model): + kind: str + + @overload + def __init__( + self, + *, + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.GitHubOrganization(_Model): + repositories: Optional[list[str]] + url: str + + @overload + def __init__( + self, + *, + repositories: Optional[list[str]] = ..., + url: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.GitHubOrganizationProfile(OrganizationProfile, discriminator='GitHub'): + kind: Literal["GitHub"] + organizations: list[GitHubOrganization] + + @overload + def __init__( + self, + *, + organizations: list[GitHubOrganization] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ImageVersion(ProxyResource): + id: str + name: str + properties: Optional[ImageVersionProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[ImageVersionProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ImageVersionProperties(_Model): + version: str + + @overload + def __init__( + self, + *, + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.LogonType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INTERACTIVE = "Interactive" + SERVICE = "Service" + + + class azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity(_Model): + principal_id: Optional[str] + tenant_id: Optional[str] + type: Union[str, ManagedServiceIdentityType] + user_assigned_identities: Optional[dict[str, UserAssignedIdentity]] + + @overload + def __init__( + self, + *, + type: Union[str, ManagedServiceIdentityType], + user_assigned_identities: Optional[dict[str, UserAssignedIdentity]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + USER_ASSIGNED = "UserAssigned" + + + class azure.mgmt.devopsinfrastructure.models.ManualResourcePredictionsProfile(ResourcePredictionsProfile, discriminator='Manual'): + kind: Literal[ResourcePredictionsProfileType.MANUAL] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.NetworkProfile(_Model): + ip_addresses: Optional[list[str]] + static_ip_address_count: Optional[int] + subnet_id: Optional[str] + + @overload + def __init__( + self, + *, + static_ip_address_count: Optional[int] = ..., + subnet_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.Operation(_Model): + action_type: Optional[Union[str, ActionType]] + display: Optional[OperationDisplay] + is_data_action: Optional[bool] + name: Optional[str] + origin: Optional[Union[str, Origin]] + + @overload + def __init__( + self, + *, + display: Optional[OperationDisplay] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.OperationDisplay(_Model): + description: Optional[str] + operation: Optional[str] + provider: Optional[str] + resource: Optional[str] + + + class azure.mgmt.devopsinfrastructure.models.Organization(_Model): + alias: Optional[str] + open_access: Optional[bool] + parallelism: Optional[int] + projects: Optional[list[str]] + url: str + + @overload + def __init__( + self, + *, + alias: Optional[str] = ..., + open_access: Optional[bool] = ..., + parallelism: Optional[int] = ..., + projects: Optional[list[str]] = ..., + url: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.OrganizationProfile(_Model): + kind: str + + @overload + def __init__( + self, + *, + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SYSTEM = "system" + USER = "user" + USER_SYSTEM = "user,system" + + + class azure.mgmt.devopsinfrastructure.models.OsDiskStorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PREMIUM = "Premium" + STANDARD = "Standard" + STANDARD_SSD = "StandardSSD" + + + class azure.mgmt.devopsinfrastructure.models.OsProfile(_Model): + logon_type: Optional[Union[str, LogonType]] + secrets_management_settings: Optional[SecretsManagementSettings] + + @overload + def __init__( + self, + *, + logon_type: Optional[Union[str, LogonType]] = ..., + secrets_management_settings: Optional[SecretsManagementSettings] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.Pool(TrackedResource): + id: str + identity: Optional[ManagedServiceIdentity] + location: str + name: str + properties: Optional[PoolProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: str, + properties: Optional[PoolProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.PoolImage(_Model): + aliases: Optional[list[str]] + buffer: Optional[str] + ephemeral_type: Optional[Union[str, EphemeralType]] + is_ephemeral: Optional[bool] + provisioning_script_entry_point: Optional[str] + provisioning_script_managed_identity_client_id: Optional[str] + provisioning_script_should_restart: Optional[bool] + provisioning_script_storage_account_resource_id: Optional[str] + resource_id: Optional[str] + well_known_image_name: Optional[str] + + @overload + def __init__( + self, + *, + aliases: Optional[list[str]] = ..., + buffer: Optional[str] = ..., + ephemeral_type: Optional[Union[str, EphemeralType]] = ..., + provisioning_script_entry_point: Optional[str] = ..., + provisioning_script_managed_identity_client_id: Optional[str] = ..., + provisioning_script_should_restart: Optional[bool] = ..., + provisioning_script_storage_account_resource_id: Optional[str] = ..., + resource_id: Optional[str] = ..., + well_known_image_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.PoolProperties(_Model): + agent_profile: AgentProfile + dev_center_project_resource_id: Optional[str] + fabric_profile: FabricProfile + maximum_concurrency: int + organization_profile: OrganizationProfile + provisioning_state: Optional[Union[str, ProvisioningState]] + runtime_configuration: Optional[RuntimeConfiguration] + + @overload + def __init__( + self, + *, + agent_profile: AgentProfile, + dev_center_project_resource_id: Optional[str] = ..., + fabric_profile: FabricProfile, + maximum_concurrency: int, + organization_profile: OrganizationProfile, + provisioning_state: Optional[Union[str, ProvisioningState]] = ..., + runtime_configuration: Optional[RuntimeConfiguration] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.PoolUpdate(_Model): + identity: Optional[ManagedServiceIdentity] + properties: Optional[PoolUpdateProperties] + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + properties: Optional[PoolUpdateProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.PoolUpdateProperties(_Model): + agent_profile: Optional[AgentProfile] + dev_center_project_resource_id: Optional[str] + fabric_profile: Optional[FabricProfile] + maximum_concurrency: Optional[int] + organization_profile: Optional[OrganizationProfile] + provisioning_state: Optional[Union[str, ProvisioningState]] + runtime_configuration: Optional[RuntimeConfiguration] + + @overload + def __init__( + self, + *, + agent_profile: Optional[AgentProfile] = ..., + dev_center_project_resource_id: Optional[str] = ..., + fabric_profile: Optional[FabricProfile] = ..., + maximum_concurrency: Optional[int] = ..., + organization_profile: Optional[OrganizationProfile] = ..., + provisioning_state: Optional[Union[str, ProvisioningState]] = ..., + runtime_configuration: Optional[RuntimeConfiguration] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.PredictionPreference(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BALANCED = "Balanced" + BEST_PERFORMANCE = "BestPerformance" + MORE_COST_EFFECTIVE = "MoreCostEffective" + MORE_PERFORMANCE = "MorePerformance" + MOST_COST_EFFECTIVE = "MostCostEffective" + + + class azure.mgmt.devopsinfrastructure.models.ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACCEPTED = "Accepted" + CANCELED = "Canceled" + DELETING = "Deleting" + FAILED = "Failed" + PROVISIONING = "Provisioning" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + + class azure.mgmt.devopsinfrastructure.models.ProxyResource(Resource): + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.devopsinfrastructure.models.Quota(_Model): + current_value: int + id: str + limit: int + name: Optional[QuotaName] + unit: str + + @overload + def __init__( + self, + *, + current_value: int, + id: str, + limit: int, + unit: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.QuotaName(_Model): + localized_value: Optional[str] + value: Optional[str] + + @overload + def __init__( + self, + *, + localized_value: Optional[str] = ..., + value: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.Resource(_Model): + id: Optional[str] + name: Optional[str] + system_data: Optional[SystemData] + type: Optional[str] + + + class azure.mgmt.devopsinfrastructure.models.ResourceDetailsObject(ProxyResource): + id: str + name: str + properties: Optional[ResourceDetailsObjectProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[ResourceDetailsObjectProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceDetailsObjectProperties(_Model): + image: str + image_version: str + status: Union[str, ResourceStatus] + + @overload + def __init__( + self, + *, + image: str, + image_version: str, + status: Union[str, ResourceStatus] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourcePredictions(_Model): + + + class azure.mgmt.devopsinfrastructure.models.ResourcePredictionsProfile(_Model): + kind: str + + @overload + def __init__( + self, + *, + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourcePredictionsProfileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTOMATIC = "Automatic" + MANUAL = "Manual" + + + class azure.mgmt.devopsinfrastructure.models.ResourceSku(ProxyResource): + id: str + name: str + properties: Optional[ResourceSkuProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[ResourceSkuProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuCapabilities(_Model): + name: str + value: str + + @overload + def __init__( + self, + *, + name: str, + value: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuLocationInfo(_Model): + location: str + zone_details: list[ResourceSkuZoneDetails] + zones: list[str] + + @overload + def __init__( + self, + *, + location: str, + zone_details: list[ResourceSkuZoneDetails], + zones: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuProperties(_Model): + capabilities: list[ResourceSkuCapabilities] + family: str + location_info: list[ResourceSkuLocationInfo] + locations: list[str] + resource_type: str + restrictions: list[ResourceSkuRestrictions] + size: str + tier: str + + @overload + def __init__( + self, + *, + capabilities: list[ResourceSkuCapabilities], + family: str, + location_info: list[ResourceSkuLocationInfo], + locations: list[str], + resource_type: str, + restrictions: list[ResourceSkuRestrictions], + size: str, + tier: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionInfo(_Model): + locations: Optional[list[str]] + zones: Optional[list[str]] + + @overload + def __init__( + self, + *, + locations: Optional[list[str]] = ..., + zones: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictions(_Model): + reason_code: Optional[Union[str, ResourceSkuRestrictionsReasonCode]] + restriction_info: ResourceSkuRestrictionInfo + type: Optional[Union[str, ResourceSkuRestrictionsType]] + values_property: list[str] + + @overload + def __init__( + self, + *, + reason_code: Optional[Union[str, ResourceSkuRestrictionsReasonCode]] = ..., + restriction_info: ResourceSkuRestrictionInfo, + type: Optional[Union[str, ResourceSkuRestrictionsType]] = ..., + values_property: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + QUOTA_ID = "QuotaId" + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LOCATION = "Location" + ZONE = "Zone" + + + class azure.mgmt.devopsinfrastructure.models.ResourceSkuZoneDetails(_Model): + capabilities: list[ResourceSkuCapabilities] + name: list[str] + + @overload + def __init__( + self, + *, + capabilities: list[ResourceSkuCapabilities], + name: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.ResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALLOCATED = "Allocated" + LEASED = "Leased" + NOT_READY = "NotReady" + PENDING_REIMAGE = "PendingReimage" + PENDING_RETURN = "PendingReturn" + PROVISIONING = "Provisioning" + READY = "Ready" + REIMAGING = "Reimaging" + RETURNED = "Returned" + STARTING = "Starting" + UPDATING = "Updating" + + + class azure.mgmt.devopsinfrastructure.models.RuntimeConfiguration(_Model): + work_folder: Optional[str] + + @overload + def __init__( + self, + *, + work_folder: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.SecretsManagementSettings(_Model): + certificate_store_location: Optional[str] + certificate_store_name: Optional[Union[str, CertificateStoreNameOption]] + key_exportable: bool + observed_certificates: list[str] + + @overload + def __init__( + self, + *, + certificate_store_location: Optional[str] = ..., + certificate_store_name: Optional[Union[str, CertificateStoreNameOption]] = ..., + key_exportable: bool, + observed_certificates: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.Stateful(AgentProfile, discriminator='Stateful'): + grace_period_time_span: Optional[str] + kind: Literal["Stateful"] + max_agent_lifetime: Optional[str] + resource_predictions: ResourcePredictions + resource_predictions_profile: ResourcePredictionsProfile + + @overload + def __init__( + self, + *, + grace_period_time_span: Optional[str] = ..., + max_agent_lifetime: Optional[str] = ..., + resource_predictions: Optional[ResourcePredictions] = ..., + resource_predictions_profile: Optional[ResourcePredictionsProfile] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.StatelessAgentProfile(AgentProfile, discriminator='Stateless'): + kind: Literal["Stateless"] + resource_predictions: ResourcePredictions + resource_predictions_profile: ResourcePredictionsProfile + + @overload + def __init__( + self, + *, + resource_predictions: Optional[ResourcePredictions] = ..., + resource_predictions_profile: Optional[ResourcePredictionsProfile] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.StorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PREMIUM_LRS = "Premium_LRS" + PREMIUM_ZRS = "Premium_ZRS" + STANDARD_LRS = "Standard_LRS" + STANDARD_SSDLRS = "StandardSSD_LRS" + STANDARD_SSDZRS = "StandardSSD_ZRS" + + + class azure.mgmt.devopsinfrastructure.models.StorageProfile(_Model): + data_disks: Optional[list[DataDisk]] + os_disk_storage_account_type: Optional[Union[str, OsDiskStorageAccountType]] + + @overload + def __init__( + self, + *, + data_disks: Optional[list[DataDisk]] = ..., + os_disk_storage_account_type: Optional[Union[str, OsDiskStorageAccountType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.SystemData(_Model): + created_at: Optional[datetime] + created_by: Optional[str] + created_by_type: Optional[Union[str, CreatedByType]] + last_modified_at: Optional[datetime] + last_modified_by: Optional[str] + last_modified_by_type: Optional[Union[str, CreatedByType]] + + @overload + def __init__( + self, + *, + created_at: Optional[datetime] = ..., + created_by: Optional[str] = ..., + created_by_type: Optional[Union[str, CreatedByType]] = ..., + last_modified_at: Optional[datetime] = ..., + last_modified_by: Optional[str] = ..., + last_modified_by_type: Optional[Union[str, CreatedByType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.TrackedResource(Resource): + id: str + location: str + name: str + system_data: SystemData + tags: Optional[dict[str, str]] + type: str + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.UserAssignedIdentity(_Model): + client_id: Optional[str] + principal_id: Optional[str] + + + class azure.mgmt.devopsinfrastructure.models.VmSize(_Model): + name: Optional[str] + + @overload + def __init__( + self, + *, + name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.devopsinfrastructure.models.VmssFabricProfile(FabricProfile, discriminator='Vmss'): + images: list[PoolImage] + kind: Literal["Vmss"] + network_profile: Optional[NetworkProfile] + os_profile: Optional[OsProfile] + sku: DevOpsAzureSku + storage_profile: Optional[StorageProfile] + + @overload + def __init__( + self, + *, + images: list[PoolImage], + network_profile: Optional[NetworkProfile] = ..., + os_profile: Optional[OsProfile] = ..., + sku: DevOpsAzureSku, + storage_profile: Optional[StorageProfile] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + +namespace azure.mgmt.devopsinfrastructure.operations + + class azure.mgmt.devopsinfrastructure.operations.ImageVersionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_image( + self, + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> ItemPaged[ImageVersion]: ... + + + class azure.mgmt.devopsinfrastructure.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[Operation]: ... + + + class azure.mgmt.devopsinfrastructure.operations.PoolsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Pool]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Pool]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Pool]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Pool]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Pool]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Pool]: ... + + @overload + def check_name_availability( + self, + body: CheckNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + def check_name_availability( + self, + body: CheckNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + def check_name_availability( + self, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + pool_name: str, + **kwargs: Any + ) -> Pool: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> ItemPaged[Pool]: ... + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged[Pool]: ... + + + class azure.mgmt.devopsinfrastructure.operations.ResourceDetailsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_pool( + self, + resource_group_name: str, + pool_name: str, + **kwargs: Any + ) -> ItemPaged[ResourceDetailsObject]: ... + + + class azure.mgmt.devopsinfrastructure.operations.SkuOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_location( + self, + location_name: str, + **kwargs: Any + ) -> ItemPaged[ResourceSku]: ... + + + class azure.mgmt.devopsinfrastructure.operations.SubscriptionUsagesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def usages( + self, + location: str, + **kwargs: Any + ) -> ItemPaged[Quota]: ... + + +namespace azure.mgmt.devopsinfrastructure.types + + class azure.mgmt.devopsinfrastructure.types.AutomaticResourcePredictionsProfile(TypedDict, total=False): + key "kind": Required[Literal[ResourcePredictionsProfileType.AUTOMATIC]] + key "predictionPreference": Union[str, PredictionPreference] + kind: Literal[ResourcePredictionsProfileType.AUTOMATIC] + prediction_preference: Union[str, PredictionPreference] + + + class azure.mgmt.devopsinfrastructure.types.AzureDevOpsOrganizationProfile(TypedDict, total=False): + key "alias": str + key "description": str + key "kind": Required[Literal["AzureDevOps"]] + key "organizations": Required[list[Organization]] + key "permissionProfile": ForwardRef('AzureDevOpsPermissionProfile', module='types') + key "updateDescription": bool + alias: str + description: str + kind: Literal[AzureDevOps] + organizations: list[Organization] + permission_profile: AzureDevOpsPermissionProfile + update_description: bool + + + class azure.mgmt.devopsinfrastructure.types.AzureDevOpsPermissionProfile(TypedDict, total=False): + key "kind": Required[Union[str, AzureDevOpsPermissionType]] + groups: list[str] + kind: Union[str, AzureDevOpsPermissionType] + users: list[str] + + + class azure.mgmt.devopsinfrastructure.types.CheckNameAvailability(TypedDict, total=False): + key "name": Required[str] + key "type": Required[Union[str, DevOpsInfrastructureResourceType]] + name: str + type: Union[str, DevOpsInfrastructureResourceType] + + + class azure.mgmt.devopsinfrastructure.types.DataDisk(TypedDict, total=False): + key "caching": Union[str, CachingType] + key "diskSizeGiB": int + key "driveLetter": str + key "storageAccountType": Union[str, StorageAccountType] + caching: Union[str, CachingType] + disk_size_gi_b: int + drive_letter: str + storage_account_type: Union[str, StorageAccountType] + + + class azure.mgmt.devopsinfrastructure.types.DeleteResourcesDetails(TypedDict, total=False): + key "resourceIds": Required[list[str]] + resource_ids: list[str] + + + class azure.mgmt.devopsinfrastructure.types.DevOpsAzureSku(TypedDict, total=False): + key "linuxNvmePath": str + key "name": Required[str] + key "windowsNvmeDrive": str + linux_nvme_path: str + name: str + vmSizes: list[VmSize] + vm_sizes: list[VmSize] + windows_nvme_drive: str + + + class azure.mgmt.devopsinfrastructure.types.FabricProfile(TypedDict, total=False): + key "images": Required[list[PoolImage]] + key "kind": Required[Literal["Vmss"]] + key "networkProfile": ForwardRef('NetworkProfile', module='types') + key "osProfile": ForwardRef('OsProfile', module='types') + key "sku": Required[DevOpsAzureSku] + key "storageProfile": ForwardRef('StorageProfile', module='types') + images: list[PoolImage] + kind: Literal[Vmss] + network_profile: NetworkProfile + os_profile: OsProfile + sku: DevOpsAzureSku + storage_profile: StorageProfile + + + class azure.mgmt.devopsinfrastructure.types.GitHubOrganization(TypedDict, total=False): + key "url": Required[str] + repositories: list[str] + url: str + + + class azure.mgmt.devopsinfrastructure.types.GitHubOrganizationProfile(TypedDict, total=False): + key "kind": Required[Literal["GitHub"]] + key "organizations": Required[list[GitHubOrganization]] + kind: Literal[GitHub] + organizations: list[GitHubOrganization] + + + class azure.mgmt.devopsinfrastructure.types.ManagedServiceIdentity(TypedDict, total=False): + key "principalId": str + key "tenantId": str + key "type": Required[Union[str, ManagedServiceIdentityType]] + principal_id: str + tenant_id: str + type: Union[str, ManagedServiceIdentityType] + userAssignedIdentities: dict[str, UserAssignedIdentity] + user_assigned_identities: dict[str, UserAssignedIdentity] + + + class azure.mgmt.devopsinfrastructure.types.ManualResourcePredictionsProfile(TypedDict, total=False): + key "kind": Required[Literal[ResourcePredictionsProfileType.MANUAL]] + kind: Literal[ResourcePredictionsProfileType.MANUAL] + + + class azure.mgmt.devopsinfrastructure.types.NetworkProfile(TypedDict, total=False): + key "staticIpAddressCount": int + key "subnetId": str + ipAddresses: list[str] + ip_addresses: list[str] + static_ip_address_count: int + subnet_id: str + + + class azure.mgmt.devopsinfrastructure.types.Organization(TypedDict, total=False): + key "alias": str + key "openAccess": bool + key "parallelism": int + key "url": Required[str] + alias: str + open_access: bool + parallelism: int + projects: list[str] + url: str + + + class azure.mgmt.devopsinfrastructure.types.OsProfile(TypedDict, total=False): + key "logonType": Union[str, LogonType] + key "secretsManagementSettings": ForwardRef('SecretsManagementSettings', module='types') + logon_type: Union[str, LogonType] + secrets_management_settings: SecretsManagementSettings + + + class azure.mgmt.devopsinfrastructure.types.Pool(TrackedResource): + key "id": str + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "location": Required[str] + key "name": str + key "properties": ForwardRef('PoolProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: PoolProperties + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.devopsinfrastructure.types.PoolImage(TypedDict, total=False): + key "buffer": str + key "ephemeralType": Union[str, EphemeralType] + key "isEphemeral": bool + key "provisioningScriptEntryPoint": str + key "provisioningScriptManagedIdentityClientId": str + key "provisioningScriptShouldRestart": bool + key "provisioningScriptStorageAccountResourceId": str + key "resourceId": str + key "wellKnownImageName": str + aliases: list[str] + buffer: str + ephemeral_type: Union[str, EphemeralType] + is_ephemeral: bool + provisioning_script_entry_point: str + provisioning_script_managed_identity_client_id: str + provisioning_script_should_restart: bool + provisioning_script_storage_account_resource_id: str + resource_id: str + well_known_image_name: str + + + class azure.mgmt.devopsinfrastructure.types.PoolProperties(TypedDict, total=False): + key "agentProfile": Required[AgentProfile] + key "devCenterProjectResourceId": str + key "fabricProfile": Required[FabricProfile] + key "maximumConcurrency": Required[int] + key "organizationProfile": Required[OrganizationProfile] + key "provisioningState": Union[str, ProvisioningState] + key "runtimeConfiguration": ForwardRef('RuntimeConfiguration', module='types') + agent_profile: AgentProfile + dev_center_project_resource_id: str + fabric_profile: FabricProfile + maximum_concurrency: int + organization_profile: OrganizationProfile + provisioning_state: Union[str, ProvisioningState] + runtime_configuration: RuntimeConfiguration + + + class azure.mgmt.devopsinfrastructure.types.PoolUpdate(TypedDict, total=False): + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "properties": ForwardRef('PoolUpdateProperties', module='types') + identity: ManagedServiceIdentity + properties: PoolUpdateProperties + tags: dict[str, str] + + + class azure.mgmt.devopsinfrastructure.types.PoolUpdateProperties(TypedDict, total=False): + key "agentProfile": ForwardRef('AgentProfile', module='types') + key "devCenterProjectResourceId": str + key "fabricProfile": ForwardRef('FabricProfile', module='types') + key "maximumConcurrency": int + key "organizationProfile": ForwardRef('OrganizationProfile', module='types') + key "provisioningState": Union[str, ProvisioningState] + key "runtimeConfiguration": ForwardRef('RuntimeConfiguration', module='types') + agent_profile: AgentProfile + dev_center_project_resource_id: str + fabric_profile: FabricProfile + maximum_concurrency: int + organization_profile: OrganizationProfile + provisioning_state: Union[str, ProvisioningState] + runtime_configuration: RuntimeConfiguration + + + class azure.mgmt.devopsinfrastructure.types.Resource(TypedDict, total=False): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.devopsinfrastructure.types.ResourcePredictions(TypedDict, total=False): + + + class azure.mgmt.devopsinfrastructure.types.ResourcePredictionsProfileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTOMATIC = "Automatic" + MANUAL = "Manual" + + + class azure.mgmt.devopsinfrastructure.types.RuntimeConfiguration(TypedDict, total=False): + key "workFolder": str + work_folder: str + + + class azure.mgmt.devopsinfrastructure.types.SecretsManagementSettings(TypedDict, total=False): + key "certificateStoreLocation": str + key "certificateStoreName": Union[str, CertificateStoreNameOption] + key "keyExportable": Required[bool] + key "observedCertificates": Required[list[str]] + certificate_store_location: str + certificate_store_name: Union[str, CertificateStoreNameOption] + key_exportable: bool + observed_certificates: list[str] + + + class azure.mgmt.devopsinfrastructure.types.Stateful(TypedDict, total=False): + key "gracePeriodTimeSpan": str + key "kind": Required[Literal["Stateful"]] + key "maxAgentLifetime": str + key "resourcePredictions": ForwardRef('ResourcePredictions', module='types') + key "resourcePredictionsProfile": ForwardRef('ResourcePredictionsProfile', module='types') + grace_period_time_span: str + kind: Literal[Stateful] + max_agent_lifetime: str + resource_predictions: ResourcePredictions + resource_predictions_profile: ResourcePredictionsProfile + + + class azure.mgmt.devopsinfrastructure.types.StatelessAgentProfile(TypedDict, total=False): + key "kind": Required[Literal["Stateless"]] + key "resourcePredictions": ForwardRef('ResourcePredictions', module='types') + key "resourcePredictionsProfile": ForwardRef('ResourcePredictionsProfile', module='types') + kind: Literal[Stateless] + resource_predictions: ResourcePredictions + resource_predictions_profile: ResourcePredictionsProfile + + + class azure.mgmt.devopsinfrastructure.types.StorageProfile(TypedDict, total=False): + key "osDiskStorageAccountType": Union[str, OsDiskStorageAccountType] + dataDisks: list[DataDisk] + data_disks: list[DataDisk] + os_disk_storage_account_type: Union[str, OsDiskStorageAccountType] + + + class azure.mgmt.devopsinfrastructure.types.SystemData(TypedDict, total=False): + key "createdAt": str + key "createdBy": str + key "createdByType": Union[str, CreatedByType] + key "lastModifiedAt": str + key "lastModifiedBy": str + key "lastModifiedByType": Union[str, CreatedByType] + created_at: str + created_by: str + created_by_type: Union[str, CreatedByType] + last_modified_at: str + last_modified_by: str + last_modified_by_type: Union[str, CreatedByType] + + + class azure.mgmt.devopsinfrastructure.types.TrackedResource(Resource): + key "id": str + key "location": Required[str] + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.devopsinfrastructure.types.UserAssignedIdentity(TypedDict, total=False): + key "clientId": str + key "principalId": str + client_id: str + principal_id: str + + + class azure.mgmt.devopsinfrastructure.types.VmSize(TypedDict, total=False): + key "name": str + name: str + + + class azure.mgmt.devopsinfrastructure.types.VmssFabricProfile(TypedDict, total=False): + key "images": Required[list[PoolImage]] + key "kind": Required[Literal["Vmss"]] + key "networkProfile": ForwardRef('NetworkProfile', module='types') + key "osProfile": ForwardRef('OsProfile', module='types') + key "sku": Required[DevOpsAzureSku] + key "storageProfile": ForwardRef('StorageProfile', module='types') + images: list[PoolImage] + kind: Literal[Vmss] + network_profile: NetworkProfile + os_profile: OsProfile + sku: DevOpsAzureSku + storage_profile: StorageProfile + + +``` \ No newline at end of file diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/api.metadata.yml b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/api.metadata.yml new file mode 100644 index 000000000000..bd14ff270d23 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/api.metadata.yml @@ -0,0 +1,3 @@ +apiMdSha256: dca4fdaf74999f9dc4400cbdbd71c616abc17d5c7f703c8541ed9b1d15c38260 +parserVersion: 0.3.30 +pythonVersion: 3.13.14 diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/apiview-properties.json b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/apiview-properties.json new file mode 100644 index 000000000000..28c7d0ca4e17 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/apiview-properties.json @@ -0,0 +1,107 @@ +{ + "CrossLanguagePackageId": "Microsoft.DevOpsInfrastructure", + "CrossLanguageDefinitionId": { + "azure.mgmt.devopsinfrastructure.models.AgentProfile": "Microsoft.DevOpsInfrastructure.AgentProfile", + "azure.mgmt.devopsinfrastructure.models.ResourcePredictionsProfile": "Microsoft.DevOpsInfrastructure.ResourcePredictionsProfile", + "azure.mgmt.devopsinfrastructure.models.AutomaticResourcePredictionsProfile": "Microsoft.DevOpsInfrastructure.AutomaticResourcePredictionsProfile", + "azure.mgmt.devopsinfrastructure.models.OrganizationProfile": "Microsoft.DevOpsInfrastructure.OrganizationProfile", + "azure.mgmt.devopsinfrastructure.models.AzureDevOpsOrganizationProfile": "Microsoft.DevOpsInfrastructure.AzureDevOpsOrganizationProfile", + "azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionProfile": "Microsoft.DevOpsInfrastructure.AzureDevOpsPermissionProfile", + "azure.mgmt.devopsinfrastructure.models.CheckNameAvailability": "Microsoft.DevOpsInfrastructure.CheckNameAvailability", + "azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult": "Microsoft.DevOpsInfrastructure.CheckNameAvailabilityResult", + "azure.mgmt.devopsinfrastructure.models.DataDisk": "Microsoft.DevOpsInfrastructure.DataDisk", + "azure.mgmt.devopsinfrastructure.models.DeleteResourcesDetails": "Microsoft.DevOpsInfrastructure.DeleteResourcesDetails", + "azure.mgmt.devopsinfrastructure.models.DevOpsAzureSku": "Microsoft.DevOpsInfrastructure.DevOpsAzureSku", + "azure.mgmt.devopsinfrastructure.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.devopsinfrastructure.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.devopsinfrastructure.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.devopsinfrastructure.models.FabricProfile": "Microsoft.DevOpsInfrastructure.FabricProfile", + "azure.mgmt.devopsinfrastructure.models.GitHubOrganization": "Microsoft.DevOpsInfrastructure.GitHubOrganization", + "azure.mgmt.devopsinfrastructure.models.GitHubOrganizationProfile": "Microsoft.DevOpsInfrastructure.GitHubOrganizationProfile", + "azure.mgmt.devopsinfrastructure.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.devopsinfrastructure.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.devopsinfrastructure.models.ImageVersion": "Microsoft.DevOpsInfrastructure.ImageVersion", + "azure.mgmt.devopsinfrastructure.models.ImageVersionProperties": "Microsoft.DevOpsInfrastructure.ImageVersionProperties", + "azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.devopsinfrastructure.models.ManualResourcePredictionsProfile": "Microsoft.DevOpsInfrastructure.ManualResourcePredictionsProfile", + "azure.mgmt.devopsinfrastructure.models.NetworkProfile": "Microsoft.DevOpsInfrastructure.NetworkProfile", + "azure.mgmt.devopsinfrastructure.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.devopsinfrastructure.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.devopsinfrastructure.models.Organization": "Microsoft.DevOpsInfrastructure.Organization", + "azure.mgmt.devopsinfrastructure.models.OsProfile": "Microsoft.DevOpsInfrastructure.OsProfile", + "azure.mgmt.devopsinfrastructure.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.devopsinfrastructure.models.Pool": "Microsoft.DevOpsInfrastructure.Pool", + "azure.mgmt.devopsinfrastructure.models.PoolImage": "Microsoft.DevOpsInfrastructure.PoolImage", + "azure.mgmt.devopsinfrastructure.models.PoolProperties": "Microsoft.DevOpsInfrastructure.PoolProperties", + "azure.mgmt.devopsinfrastructure.models.PoolUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.devopsinfrastructure.models.PoolUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.devopsinfrastructure.models.Quota": "Microsoft.DevOpsInfrastructure.Quota", + "azure.mgmt.devopsinfrastructure.models.QuotaName": "Microsoft.DevOpsInfrastructure.QuotaName", + "azure.mgmt.devopsinfrastructure.models.ResourceDetailsObject": "Microsoft.DevOpsInfrastructure.ResourceDetailsObject", + "azure.mgmt.devopsinfrastructure.models.ResourceDetailsObjectProperties": "Microsoft.DevOpsInfrastructure.ResourceDetailsObjectProperties", + "azure.mgmt.devopsinfrastructure.models.ResourcePredictions": "Microsoft.DevOpsInfrastructure.ResourcePredictions", + "azure.mgmt.devopsinfrastructure.models.ResourceSku": "Microsoft.DevOpsInfrastructure.ResourceSku", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuCapabilities": "Microsoft.DevOpsInfrastructure.ResourceSkuCapabilities", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuLocationInfo": "Microsoft.DevOpsInfrastructure.ResourceSkuLocationInfo", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuProperties": "Microsoft.DevOpsInfrastructure.ResourceSkuProperties", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionInfo": "Microsoft.DevOpsInfrastructure.ResourceSkuRestrictionInfo", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictions": "Microsoft.DevOpsInfrastructure.ResourceSkuRestrictions", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuZoneDetails": "Microsoft.DevOpsInfrastructure.ResourceSkuZoneDetails", + "azure.mgmt.devopsinfrastructure.models.RuntimeConfiguration": "Microsoft.DevOpsInfrastructure.RuntimeConfiguration", + "azure.mgmt.devopsinfrastructure.models.SecretsManagementSettings": "Microsoft.DevOpsInfrastructure.SecretsManagementSettings", + "azure.mgmt.devopsinfrastructure.models.Stateful": "Microsoft.DevOpsInfrastructure.Stateful", + "azure.mgmt.devopsinfrastructure.models.StatelessAgentProfile": "Microsoft.DevOpsInfrastructure.StatelessAgentProfile", + "azure.mgmt.devopsinfrastructure.models.StorageProfile": "Microsoft.DevOpsInfrastructure.StorageProfile", + "azure.mgmt.devopsinfrastructure.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.devopsinfrastructure.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.devopsinfrastructure.models.VmSize": "Microsoft.DevOpsInfrastructure.VmSize", + "azure.mgmt.devopsinfrastructure.models.VmssFabricProfile": "Microsoft.DevOpsInfrastructure.VmssFabricProfile", + "azure.mgmt.devopsinfrastructure.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.devopsinfrastructure.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.devopsinfrastructure.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.devopsinfrastructure.models.ProvisioningState": "Microsoft.DevOpsInfrastructure.ProvisioningState", + "azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionType": "Microsoft.DevOpsInfrastructure.AzureDevOpsPermissionType", + "azure.mgmt.devopsinfrastructure.models.ResourcePredictionsProfileType": "Microsoft.DevOpsInfrastructure.ResourcePredictionsProfileType", + "azure.mgmt.devopsinfrastructure.models.PredictionPreference": "Microsoft.DevOpsInfrastructure.PredictionPreference", + "azure.mgmt.devopsinfrastructure.models.EphemeralType": "Microsoft.DevOpsInfrastructure.EphemeralType", + "azure.mgmt.devopsinfrastructure.models.CertificateStoreNameOption": "Microsoft.DevOpsInfrastructure.CertificateStoreNameOption", + "azure.mgmt.devopsinfrastructure.models.LogonType": "Microsoft.DevOpsInfrastructure.LogonType", + "azure.mgmt.devopsinfrastructure.models.OsDiskStorageAccountType": "Microsoft.DevOpsInfrastructure.OsDiskStorageAccountType", + "azure.mgmt.devopsinfrastructure.models.CachingType": "Microsoft.DevOpsInfrastructure.CachingType", + "azure.mgmt.devopsinfrastructure.models.StorageAccountType": "Microsoft.DevOpsInfrastructure.StorageAccountType", + "azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.devopsinfrastructure.models.AvailabilityStatus": "Microsoft.DevOpsInfrastructure.AvailabilityStatus", + "azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityReason": "Microsoft.DevOpsInfrastructure.CheckNameAvailabilityReason", + "azure.mgmt.devopsinfrastructure.models.DevOpsInfrastructureResourceType": "Microsoft.DevOpsInfrastructure.DevOpsInfrastructureResourceType", + "azure.mgmt.devopsinfrastructure.models.ResourceStatus": "Microsoft.DevOpsInfrastructure.ResourceStatus", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionsType": "Microsoft.DevOpsInfrastructure.ResourceSkuRestrictionsType", + "azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionsReasonCode": "Microsoft.DevOpsInfrastructure.ResourceSkuRestrictionsReasonCode", + "azure.mgmt.devopsinfrastructure.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.devopsinfrastructure.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.get": "Microsoft.DevOpsInfrastructure.Pools.get", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.get": "Microsoft.DevOpsInfrastructure.Pools.get", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.begin_create_or_update": "Microsoft.DevOpsInfrastructure.Pools.createOrUpdate", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.begin_create_or_update": "Microsoft.DevOpsInfrastructure.Pools.createOrUpdate", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.begin_update": "Microsoft.DevOpsInfrastructure.Pools.update", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.begin_update": "Microsoft.DevOpsInfrastructure.Pools.update", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.begin_delete": "Microsoft.DevOpsInfrastructure.Pools.delete", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.begin_delete": "Microsoft.DevOpsInfrastructure.Pools.delete", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.list_by_resource_group": "Microsoft.DevOpsInfrastructure.Pools.listByResourceGroup", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.list_by_resource_group": "Microsoft.DevOpsInfrastructure.Pools.listByResourceGroup", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.list_by_subscription": "Microsoft.DevOpsInfrastructure.Pools.listBySubscription", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.list_by_subscription": "Microsoft.DevOpsInfrastructure.Pools.listBySubscription", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.check_name_availability": "Microsoft.DevOpsInfrastructure.Pools.checkNameAvailability", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.check_name_availability": "Microsoft.DevOpsInfrastructure.Pools.checkNameAvailability", + "azure.mgmt.devopsinfrastructure.operations.PoolsOperations.delete_resources": "Microsoft.DevOpsInfrastructure.Pools.deleteResources", + "azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations.delete_resources": "Microsoft.DevOpsInfrastructure.Pools.deleteResources", + "azure.mgmt.devopsinfrastructure.operations.ResourceDetailsOperations.list_by_pool": "Microsoft.DevOpsInfrastructure.ResourceDetails.listByPool", + "azure.mgmt.devopsinfrastructure.aio.operations.ResourceDetailsOperations.list_by_pool": "Microsoft.DevOpsInfrastructure.ResourceDetails.listByPool", + "azure.mgmt.devopsinfrastructure.operations.SkuOperations.list_by_location": "Microsoft.DevOpsInfrastructure.Sku.listByLocation", + "azure.mgmt.devopsinfrastructure.aio.operations.SkuOperations.list_by_location": "Microsoft.DevOpsInfrastructure.Sku.listByLocation", + "azure.mgmt.devopsinfrastructure.operations.SubscriptionUsagesOperations.usages": "Microsoft.DevOpsInfrastructure.SubscriptionUsages.usages", + "azure.mgmt.devopsinfrastructure.aio.operations.SubscriptionUsagesOperations.usages": "Microsoft.DevOpsInfrastructure.SubscriptionUsages.usages", + "azure.mgmt.devopsinfrastructure.operations.ImageVersionsOperations.list_by_image": "Microsoft.DevOpsInfrastructure.ImageVersions.listByImage", + "azure.mgmt.devopsinfrastructure.aio.operations.ImageVersionsOperations.list_by_image": "Microsoft.DevOpsInfrastructure.ImageVersions.listByImage" + }, + "CrossLanguageVersion": "040dd8ee78e5" +} \ No newline at end of file diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py index 8f06e13ef998..6c010fdec339 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py @@ -5,15 +5,21 @@ # 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 ._client import DevOpsInfrastructureMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import DevOpsInfrastructureMgmtClient # 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 diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_client.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_client.py index 11a34eacbf5d..055785431819 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_client.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_client.py @@ -7,16 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self +import sys +from typing import Any, Optional, TYPE_CHECKING, cast from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from ._configuration import DevOpsInfrastructureMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( ImageVersionsOperations, Operations, @@ -26,7 +28,13 @@ SubscriptionUsagesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -50,10 +58,15 @@ class DevOpsInfrastructureMgmtClient: :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". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2024-10-19". - Note that overriding this default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-07-03-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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. @@ -63,13 +76,26 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DevOpsInfrastructureMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -88,7 +114,7 @@ def __init__( 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._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py index fa50fa2e2787..9a4de4e725ae 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -29,8 +30,13 @@ class DevOpsInfrastructureMgmtClientConfiguration: # pylint: disable=too-many-i :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 "2024-10-19". - Note that overriding this default value may result in unsupported behavior. + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-07-03-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -39,9 +45,10 @@ def __init__( credential: "TokenCredential", subscription_id: str, base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-19") + api_version: str = kwargs.pop("api_version", "2026-07-03-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,6 +58,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-devopsinfrastructure/{}".format(VERSION)) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_model_base.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/model_base.py similarity index 53% rename from sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_model_base.py rename to sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/model_base.py index 9d401b0cf012..1934415c1369 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_model_base.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/model_base.py @@ -1,11 +1,12 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines +# pylint: disable=protected-access, broad-except import copy import calendar @@ -21,17 +22,19 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET -from typing_extensions import Self +from collections.abc import MutableMapping import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping +from azure.core.rest import HttpResponse + +if sys.version_info >= (3, 11): + from typing import Self else: - from typing import MutableMapping + from typing_extensions import Self _LOGGER = logging.getLogger(__name__) @@ -39,6 +42,7 @@ TZ_UTC = timezone.utc _T = typing.TypeVar("_T") +_NONE_TYPE = type(None) def _timedelta_as_isostr(td: timedelta) -> str: @@ -105,6 +109,29 @@ def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: return encoded +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + def _serialize_datetime(o, format: typing.Optional[str] = None): if hasattr(o, "year") and hasattr(o, "hour"): if format == "rfc7231": @@ -173,6 +200,21 @@ def default(self, o): # pylint: disable=too-many-return-statements r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" ) +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: """Deserialize ISO-8601 formatted string into Datetime object. @@ -204,7 +246,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - return date_obj + return date_obj # type: ignore[no-any-return] def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: @@ -258,7 +300,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time: """ if isinstance(attr, time): return attr - return isodate.parse_time(attr) + return isodate.parse_time(attr) # type: ignore[no-any-return] def _deserialize_bytes(attr): @@ -282,6 +324,12 @@ def _deserialize_duration(attr): return isodate.parse_duration(attr) +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + def _deserialize_decimal(attr): if isinstance(attr, decimal.Decimal): return attr @@ -311,12 +359,18 @@ def _deserialize_int_as_str(attr): "unix-timestamp": _deserialize_datetime_unix_timestamp, "base64": _deserialize_bytes, "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), } def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore @@ -347,17 +401,47 @@ def _get_model(module_name: str, model_name: str): _UNSET = object() -class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object - def __init__(self, data: typing.Dict[str, typing.Any]) -> None: +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: self._data = data def __contains__(self, key: typing.Any) -> bool: return key in self._data def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized return self._data.__getitem__(key) def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass self._data.__setitem__(key, value) def __delitem__(self, key: str) -> None: @@ -373,55 +457,105 @@ def __ne__(self, other: typing.Any) -> bool: return not self.__eq__(other) def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on the mapping's keys + :rtype: ~typing.KeysView + """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on the mapping's values + :rtype: ~typing.ValuesView + """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: a set-like object providing a view on the mapping's items + :rtype: ~typing.ItemsView + """ return self._data.items() def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: The value for key if key is in the dictionary, else default. + :rtype: any + """ try: return self[key] except KeyError: return default @typing.overload - def pop(self, key: str) -> typing.Any: ... + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ @typing.overload - def pop(self, key: str, default: _T) -> _T: ... + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ if default is _UNSET: return self._data.pop(key) return self._data.pop(key, default) - def popitem(self) -> typing.Tuple[str, typing.Any]: + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if the dictionary is empty. + """ return self._data.popitem() def clear(self) -> None: + """ + Remove all items from the dictionary. + """ self._data.clear() - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Update the dictionary from a mapping or an iterable of key-value pairs. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ self._data.update(*args, **kwargs) @typing.overload def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Return the value for key if key is in the dictionary; otherwise set the key to + default and return default. + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: The value for key if key is in the dictionary, else default. + :rtype: any + """ if default is _UNSET: return self._data.setdefault(key) return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -438,6 +572,8 @@ def _is_model(obj: typing.Any) -> bool: def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) return [_serialize(x, format) for x in o] if isinstance(o, dict): return {k: _serialize(v, format) for k, v in o.items()} @@ -462,16 +598,14 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m pass # Last, try datetime.timedelta try: - return _timedelta_as_isostr(o) + return _serialize_duration(o, format) except AttributeError: # This will be raised when it hits value.total_seconds in the method above pass return o -def _get_rest_field( - attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str -) -> typing.Optional["_RestField"]: +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: try: return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) except StopIteration: @@ -490,69 +624,253 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: typing.Set[str] = set() + _calculated: set[str] = set() def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: # pylint: disable=too-many-nested-blocks + dict_to_pass: dict[str, typing.Any] = {} + if args: if isinstance(args[0], ET.Element): - existed_attr_keys = [] - model_meta = getattr(self, "_xml", {}) - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - if prop_meta.get("itemsName"): - xml_name = prop_meta.get("itemsName") - xml_ns = prop_meta.get("itemNs") - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = args[0].findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) - continue - - # text element is primitive type - if prop_meta.get("text", False): - if args[0].text is not None: - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = args[0].find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in args[0]: - if e.tag not in existed_attr_keys: - dict_to_pass[e.tag] = _convert_element(e) + dict_to_pass.update(self._init_from_xml(args[0])) else: dict_to_pass.update( {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} @@ -569,24 +887,133 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + def copy(self) -> "Model": return Model(self.__dict__) - def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") } annotations = { k: v for mro_class in mros - if hasattr(mro_class, "__annotations__") # pylint: disable=no-member - for k, v in mro_class.__annotations__.items() # pylint: disable=no-member + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() } for attr, rf in attr_to_rest_field.items(): rf._module = cls.__module__ @@ -594,15 +1021,32 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) if not rf._rest_name_input: rf._rest_name_input = attr - cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._backcompat_attr_to_rest_field: dict[str, _RestField] = { + Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf + for attr, rf in cls._attr_to_rest_field.items() + } + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: - if hasattr(base, "__mapping__"): # pylint: disable=no-member - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_backcompat_attribute_name(cls, attr_to_rest_field: dict[str, "_RestField"], attr_name: str) -> str: + rest_field_obj = attr_to_rest_field.get(attr_name) # pylint: disable=protected-access + if rest_field_obj is None: + return attr_name + original_tsp_name = getattr(rest_field_obj, "_original_tsp_name", None) # pylint: disable=protected-access + if original_tsp_name: + return original_tsp_name + return attr_name @classmethod def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: @@ -613,7 +1057,7 @@ def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField @classmethod def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): # pylint: disable=no-member + if not hasattr(cls, "__mapping__"): return cls(data) discriminator = cls._get_discriminator(exist_discriminators) if discriminator is None: @@ -623,7 +1067,7 @@ def _deserialize(cls, data, exist_discriminators): model_meta = getattr(cls, "_xml", {}) prop_meta = getattr(discriminator, "_xml", {}) xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) if xml_ns: xml_name = "{" + xml_ns + "}" + xml_name @@ -636,7 +1080,7 @@ def _deserialize(cls, data, exist_discriminators): mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) - def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: """Return a dict that can be turned into json using json.dump. :keyword bool exclude_readonly: Whether to remove the readonly properties. @@ -696,7 +1140,7 @@ def _deserialize_with_union(deserializers, obj): def _deserialize_dict( value_deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], - obj: typing.Dict[typing.Any, typing.Any], + obj: dict[typing.Any, typing.Any], ): if obj is None: return obj @@ -706,7 +1150,7 @@ def _deserialize_dict( def _deserialize_multiple_sequence( - entry_deserializers: typing.List[typing.Optional[typing.Callable]], + entry_deserializers: list[typing.Optional[typing.Callable]], module: typing.Optional[str], obj, ): @@ -715,6 +1159,14 @@ def _deserialize_multiple_sequence( return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + def _deserialize_sequence( deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], @@ -724,17 +1176,30 @@ def _deserialize_sequence( return obj if isinstance(obj, ET.Element): obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) -def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: return sorted( types, key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), ) -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches annotation: typing.Any, module: typing.Optional[str], rf: typing.Optional["_RestField"] = None, @@ -754,7 +1219,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur except AttributeError: model_name = annotation if module is not None: - annotation = _get_model(module, model_name) + annotation = _get_model(module, model_name) # type: ignore try: if module and _is_model(annotation): @@ -774,16 +1239,18 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: - if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore ) return functools.partial(_deserialize_with_optional, if_obj_deserializer) # the type is Optional[Union[...]], we need to remove the None type from the Union annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) except AttributeError: pass @@ -799,7 +1266,10 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur return functools.partial(_deserialize_with_union, deserializers) try: - if annotation._name == "Dict": # pyright: ignore + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": value_deserializer = _get_deserialize_callable_from_annotation( annotation.__args__[1], module, rf # pyright: ignore ) @@ -812,7 +1282,10 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur except (AttributeError, IndexError): pass try: - if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: if len(annotation.__args__) > 1: # pyright: ignore entry_deserializers = [ _get_deserialize_callable_from_annotation(dt, module, rf) @@ -861,16 +1334,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -894,6 +1371,36 @@ def _deserialize( return _deserialize_with_callable(deserializer, value) +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -901,11 +1408,13 @@ def __init__( name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin is_discriminator: bool = False, - visibility: typing.Optional[typing.List[str]] = None, + visibility: typing.Optional[list[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, + original_tsp_name: typing.Optional[str] = None, ): self._type = type self._rest_name_input = name @@ -913,14 +1422,21 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer + self._original_tsp_name = original_tsp_name @property def _class_type(self) -> typing.Any: - return getattr(self._type, "args", [None])[0] + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result @property def _rest_name(self) -> str: @@ -931,14 +1447,44 @@ def _rest_name(self) -> str: def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class - item = obj.get(self._rest_name) + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: return item - return _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + if value is None: # we want to wipe out entries if users set attr to None try: @@ -963,11 +1509,13 @@ def rest_field( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[typing.List[str]] = None, + visibility: typing.Optional[list[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, + original_tsp_name: typing.Optional[str] = None, ) -> typing.Any: return _RestField( name=name, @@ -977,6 +1525,8 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, + original_tsp_name=original_tsp_name, ) @@ -984,8 +1534,8 @@ def rest_discriminator( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[typing.List[str]] = None, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, ) -> typing.Any: return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) @@ -1001,21 +1551,77 @@ def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + def _get_element( o: typing.Any, exclude_readonly: bool = False, - parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, typing.List[ET.Element]]: +) -> typing.Union[ET.Element, list[ET.Element]]: if _is_model(o): model_meta = getattr(o, "_xml", {}) # if prop is a model, then use the prop element directly, else generate a wrapper of model if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) wrapped_element = _create_xml_element( - model_meta.get("name", o.__class__.__name__), + element_name, model_meta.get("prefix"), - model_meta.get("ns"), + _model_ns, ) readonly_props = [] @@ -1037,7 +1643,9 @@ def _get_element( # additional properties will not have rest field, use the wire name as xml name prop_meta = {"name": k} - # if no ns for prop, use model's + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. if prop_meta.get("ns") is None and model_meta.get("ns"): prop_meta["ns"] = model_meta.get("ns") prop_meta["prefix"] = model_meta.get("prefix") @@ -1049,12 +1657,7 @@ def _get_element( # text could only set on primitive type wrapped_element.text = _get_primitive_type_value(v) elif prop_meta.get("attribute", False): - xml_name = prop_meta.get("name", k) - if prop_meta.get("ns"): - ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore - xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore - # attribute should be primitive type - wrapped_element.set(xml_name, _get_primitive_type_value(v)) + _set_xml_attribute(wrapped_element, k, v, prop_meta) else: # other wrapped prop element wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) @@ -1063,6 +1666,7 @@ def _get_element( return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore if isinstance(o, dict): result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None for k, v in o.items(): result.append( _get_wrapped_element( @@ -1070,7 +1674,7 @@ def _get_element( exclude_readonly, { "name": k, - "ns": parent_meta.get("ns") if parent_meta else None, + "ns": _dict_ns, "prefix": parent_meta.get("prefix") if parent_meta else None, }, ) @@ -1079,13 +1683,16 @@ def _get_element( # primitive case need to create element based on parent_meta if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) return _get_wrapped_element( o, exclude_readonly, { "name": parent_meta.get("itemsName", parent_meta.get("name")), "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + "ns": _items_ns, }, ) @@ -1095,10 +1702,11 @@ def _get_element( def _get_wrapped_element( v: typing.Any, exclude_readonly: bool, - meta: typing.Optional[typing.Dict[str, typing.Any]], + meta: typing.Optional[dict[str, typing.Any]], ) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns ) if isinstance(v, (dict, list)): wrapped_element.extend(_get_element(v, exclude_readonly, meta)) @@ -1106,7 +1714,7 @@ def _get_wrapped_element( _get_element(v, exclude_readonly, meta, wrapped_element) else: wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element + return wrapped_element # type: ignore[no-any-return] def _get_primitive_type_value(v) -> str: @@ -1119,9 +1727,29 @@ def _get_primitive_type_value(v) -> str: return str(v) -def _create_xml_element(tag, prefix=None, ns=None): - if prefix and ns: +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + _safe_register_namespace(prefix, ns) if ns: return ET.Element("{" + ns + "}" + tag) return ET.Element(tag) @@ -1132,13 +1760,15 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) def _convert_element(e: ET.Element): # dict case if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: typing.Dict[str, typing.Any] = {} + dict_result: dict[str, typing.Any] = {} for child in e: if dict_result.get(child.tag) is not None: if isinstance(dict_result[child.tag], list): @@ -1151,7 +1781,7 @@ def _convert_element(e: ET.Element): return dict_result # array case if len(e) > 0: - array_result: typing.List[typing.Any] = [] + array_result: list[typing.Any] = [] for child in e: array_result.append(_convert_element(child)) return array_result diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/serialization.py similarity index 88% rename from sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py rename to sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/serialization.py index 480e941d758f..75906e2eb77f 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_utils/serialization.py @@ -1,27 +1,10 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -38,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -47,10 +29,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, - List, ) try: @@ -64,9 +43,13 @@ from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +167,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -396,7 +313,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -449,25 +366,25 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +395,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -499,14 +416,13 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. :param dict response: The initial data :param dict objects: The class objects @@ -518,7 +434,7 @@ def _classify(cls, response, objects): if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -563,7 +479,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -604,6 +520,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -614,7 +534,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,7 +546,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -665,7 +585,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -736,8 +656,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +701,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +725,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +755,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +775,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -875,7 +795,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -909,13 +829,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1186,13 +1113,68 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1200,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1233,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1270,7 +1252,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1429,7 +1411,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1441,7 +1423,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1458,6 +1440,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1470,9 +1456,13 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1482,16 +1472,37 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1502,7 +1513,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1683,17 +1694,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None): subtype = getattr(response, "_subtype_map", {}) try: readonly = [ - k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") ] const = [ - k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore @@ -1713,7 +1728,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1795,7 +1810,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1841,7 +1856,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1867,7 +1882,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): @@ -1932,7 +1951,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1945,7 +1964,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1960,7 +1979,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1978,7 +1997,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1991,7 +2010,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2002,6 +2021,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. @@ -2009,7 +2070,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2025,7 +2086,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2040,14 +2101,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2063,7 +2124,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2101,7 +2162,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_validation.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py index 0ec13ea52bbf..a1f432eddc4e 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0b1" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py index b00102e663c6..483d336333f1 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py @@ -5,12 +5,18 @@ # 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 ._client import DevOpsInfrastructureMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import DevOpsInfrastructureMgmtClient # type: ignore 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 diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_client.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_client.py index 5e145bf72751..9388ad085460 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_client.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_client.py @@ -7,15 +7,17 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self +import sys +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import DevOpsInfrastructureMgmtClientConfiguration from .operations import ( ImageVersionsOperations, @@ -26,7 +28,13 @@ SubscriptionUsagesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -51,10 +59,15 @@ class DevOpsInfrastructureMgmtClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :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". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2024-10-19". - Note that overriding this default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-07-03-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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. @@ -64,13 +77,26 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DevOpsInfrastructureMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -89,7 +115,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py index 909992c5c979..33c5f77afdcf 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -29,8 +30,13 @@ class DevOpsInfrastructureMgmtClientConfiguration: # pylint: disable=too-many-i :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 "2024-10-19". - Note that overriding this default value may result in unsupported behavior. + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-07-03-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -39,9 +45,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-19") + api_version: str = kwargs.pop("api_version", "2026-07-03-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,6 +58,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-devopsinfrastructure/{}".format(VERSION)) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py index a187f0c9bdbc..025faf189e43 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py @@ -5,16 +5,22 @@ # 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 ._operations import Operations -from ._operations import PoolsOperations -from ._operations import ResourceDetailsOperations -from ._operations import SkuOperations -from ._operations import SubscriptionUsagesOperations -from ._operations import ImageVersionsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import PoolsOperations # type: ignore +from ._operations import ResourceDetailsOperations # type: ignore +from ._operations import SkuOperations # type: ignore +from ._operations import SubscriptionUsagesOperations # type: ignore +from ._operations import ImageVersionsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py index 465720a9188e..c742b33895b5 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,13 +33,17 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize +from ... import models as _models, types as _types +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ..._validation import api_version_validation from ...operations._operations import ( build_image_versions_list_by_image_request, build_operations_list_request, + build_pools_check_name_availability_request, build_pools_create_or_update_request, build_pools_delete_request, + build_pools_delete_resources_request, build_pools_get_request, build_pools_list_by_resource_group_request, build_pools_list_by_subscription_request, @@ -47,14 +52,11 @@ build_sku_list_by_location_request, build_subscription_usages_usages_request, ) +from .._configuration import DevOpsInfrastructureMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -69,24 +71,26 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models._models.Operation"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """List the operations for the provider. :return: An iterator like instance of Operation :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devopsinfrastructure.models._models.Operation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devopsinfrastructure.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models._models.Operation]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -122,7 +126,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -135,7 +142,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models._models.Operation], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -151,7 +161,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -171,10 +184,12 @@ class PoolsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: @@ -215,6 +230,7 @@ async def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -229,11 +245,14 @@ async def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.Pool, response.json()) @@ -243,7 +262,11 @@ async def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + pool_name: str, + resource: Union[_models.Pool, _types.Pool, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -281,6 +304,7 @@ async def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -294,14 +318,17 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -341,7 +368,7 @@ async def begin_create_or_update( self, resource_group_name: str, pool_name: str, - resource: JSON, + resource: _types.Pool, *, content_type: str = "application/json", **kwargs: Any @@ -354,7 +381,7 @@ async def begin_create_or_update( :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.devopsinfrastructure.types.Pool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -394,7 +421,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + pool_name: str, + resource: Union[_models.Pool, _types.Pool, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.Pool]: """Create a Pool. @@ -403,9 +434,10 @@ async def begin_create_or_update( :type resource_group_name: str :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str - :param resource: Resource create parameters. Is one of the following types: Pool, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a Pool type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool or + ~azure.mgmt.devopsinfrastructure.types.Pool or IO[bytes] :return: An instance of AsyncLROPoller that returns Pool. The Pool is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] @@ -467,7 +499,7 @@ async def _update_initial( self, resource_group_name: str, pool_name: str, - properties: Union[_models.PoolUpdate, JSON, IO[bytes]], + properties: Union[_models.PoolUpdate, _types.PoolUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -506,6 +538,7 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -519,7 +552,10 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -527,7 +563,7 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -567,7 +603,7 @@ async def begin_update( self, resource_group_name: str, pool_name: str, - properties: JSON, + properties: _types.PoolUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -580,7 +616,7 @@ async def begin_update( :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.devopsinfrastructure.types.PoolUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -623,7 +659,7 @@ async def begin_update( self, resource_group_name: str, pool_name: str, - properties: Union[_models.PoolUpdate, JSON, IO[bytes]], + properties: Union[_models.PoolUpdate, _types.PoolUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Pool]: """Update a Pool. @@ -633,9 +669,10 @@ async def begin_update( :type resource_group_name: str :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str - :param properties: The resource properties to be updated. Is one of the following types: - PoolUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a PoolUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate or + ~azure.mgmt.devopsinfrastructure.types.PoolUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns Pool. The Pool is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] @@ -720,6 +757,7 @@ async def _delete_initial(self, resource_group_name: str, pool_name: str, **kwar } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -733,7 +771,10 @@ async def _delete_initial(self, resource_group_name: str, pool_name: str, **kwar except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -741,7 +782,7 @@ async def _delete_initial(self, resource_group_name: str, pool_name: str, **kwar response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -806,7 +847,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Pool"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Pool"]: """List Pool resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -857,7 +898,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -870,7 +914,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pool], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Pool], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -886,7 +933,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -894,7 +944,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Pool"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Pool"]: """List Pool resources by subscription ID. :return: An iterator like instance of Pool @@ -941,7 +991,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -954,7 +1007,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pool], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Pool], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -970,13 +1026,312 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + @overload + async def check_name_availability( + self, body: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, body: _types.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.types.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, body: Union[_models.CheckNameAvailability, _types.CheckNameAvailability, IO[bytes]], **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Is either a CheckNameAvailability type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailability or + ~azure.mgmt.devopsinfrastructure.types.CheckNameAvailability or IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pools_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: _models.DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.DeleteResourcesDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: _types.DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.types.DeleteResourcesDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-09-20", + params_added_on={ + "2025-09-20": ["api_version", "subscription_id", "resource_group_name", "pool_name", "content_type"] + }, + api_versions_list=["2025-09-20", "2026-04-17-preview", "2026-06-02", "2026-07-03-preview"], + ) + async def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: Union[_models.DeleteResourcesDetails, _types.DeleteResourcesDetails, IO[bytes]], + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Is either a DeleteResourcesDetails type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.DeleteResourcesDetails or + ~azure.mgmt.devopsinfrastructure.types.DeleteResourcesDetails or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pools_delete_resources_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + class ResourceDetailsOperations: """ @@ -990,15 +1345,17 @@ class ResourceDetailsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_pool( self, resource_group_name: str, pool_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ResourceDetailsObject"]: + ) -> AsyncItemPaged["_models.ResourceDetailsObject"]: """List ResourceDetailsObject resources by Pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1053,7 +1410,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1066,7 +1426,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ResourceDetailsObject], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.ResourceDetailsObject], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1082,7 +1445,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1102,13 +1468,15 @@ class SkuOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_location(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: + def list_by_location(self, location_name: str, **kwargs: Any) -> AsyncItemPaged["_models.ResourceSku"]: """List ResourceSku resources by subscription ID. :param location_name: Name of the location. Required. @@ -1159,7 +1527,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1172,7 +1543,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ResourceSku], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.ResourceSku], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1188,7 +1562,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1208,13 +1585,15 @@ class SubscriptionUsagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def usages(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Quota"]: + def usages(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.Quota"]: """List Quota resources by subscription ID. :param location: The name of the Azure region. Required. @@ -1264,7 +1643,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1277,7 +1659,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Quota], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Quota], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1293,7 +1678,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1313,15 +1701,17 @@ class ImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_image( self, resource_group_name: str, image_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ImageVersion"]: + ) -> AsyncItemPaged["_models.ImageVersion"]: """List ImageVersion resources by Image. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1376,7 +1766,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1389,7 +1782,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ImageVersion], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.ImageVersion], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1405,7 +1801,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py index ca241a7c8aeb..3334dbf92a05 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py @@ -5,71 +5,96 @@ # 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 ._models import AgentProfile -from ._models import AutomaticResourcePredictionsProfile -from ._models import AzureDevOpsOrganizationProfile -from ._models import AzureDevOpsPermissionProfile -from ._models import DataDisk -from ._models import DevOpsAzureSku -from ._models import ErrorAdditionalInfo -from ._models import ErrorDetail -from ._models import ErrorResponse -from ._models import FabricProfile -from ._models import GitHubOrganization -from ._models import GitHubOrganizationProfile -from ._models import ImageVersion -from ._models import ImageVersionProperties -from ._models import ManagedServiceIdentity -from ._models import ManualResourcePredictionsProfile -from ._models import NetworkProfile -from ._models import Organization -from ._models import OrganizationProfile -from ._models import OsProfile -from ._models import Pool -from ._models import PoolImage -from ._models import PoolProperties -from ._models import PoolUpdate -from ._models import PoolUpdateProperties -from ._models import ProxyResource -from ._models import Quota -from ._models import QuotaName -from ._models import Resource -from ._models import ResourceDetailsObject -from ._models import ResourceDetailsObjectProperties -from ._models import ResourcePredictions -from ._models import ResourcePredictionsProfile -from ._models import ResourceSku -from ._models import ResourceSkuCapabilities -from ._models import ResourceSkuLocationInfo -from ._models import ResourceSkuProperties -from ._models import ResourceSkuRestrictionInfo -from ._models import ResourceSkuRestrictions -from ._models import ResourceSkuZoneDetails -from ._models import SecretsManagementSettings -from ._models import Stateful -from ._models import StatelessAgentProfile -from ._models import StorageProfile -from ._models import SystemData -from ._models import TrackedResource -from ._models import UserAssignedIdentity -from ._models import VmssFabricProfile +from typing import TYPE_CHECKING -from ._enums import AzureDevOpsPermissionType -from ._enums import CachingType -from ._enums import CreatedByType -from ._enums import LogonType -from ._enums import ManagedServiceIdentityType -from ._enums import OsDiskStorageAccountType -from ._enums import PredictionPreference -from ._enums import ProvisioningState -from ._enums import ResourcePredictionsProfileType -from ._enums import ResourceSkuRestrictionsReasonCode -from ._enums import ResourceSkuRestrictionsType -from ._enums import ResourceStatus -from ._enums import StorageAccountType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AgentProfile, + AutomaticResourcePredictionsProfile, + AzureDevOpsOrganizationProfile, + AzureDevOpsPermissionProfile, + CheckNameAvailability, + CheckNameAvailabilityResult, + DataDisk, + DeleteResourcesDetails, + DevOpsAzureSku, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + FabricProfile, + GitHubOrganization, + GitHubOrganizationProfile, + ImageVersion, + ImageVersionProperties, + ManagedServiceIdentity, + ManualResourcePredictionsProfile, + NetworkProfile, + Operation, + OperationDisplay, + Organization, + OrganizationProfile, + OsProfile, + Pool, + PoolImage, + PoolProperties, + PoolUpdate, + PoolUpdateProperties, + ProxyResource, + Quota, + QuotaName, + Resource, + ResourceDetailsObject, + ResourceDetailsObjectProperties, + ResourcePredictions, + ResourcePredictionsProfile, + ResourceSku, + ResourceSkuCapabilities, + ResourceSkuLocationInfo, + ResourceSkuProperties, + ResourceSkuRestrictionInfo, + ResourceSkuRestrictions, + ResourceSkuZoneDetails, + RuntimeConfiguration, + SecretsManagementSettings, + Stateful, + StatelessAgentProfile, + StorageProfile, + SystemData, + TrackedResource, + UserAssignedIdentity, + VmSize, + VmssFabricProfile, +) + +from ._enums import ( # type: ignore + ActionType, + AvailabilityStatus, + AzureDevOpsPermissionType, + CachingType, + CertificateStoreNameOption, + CheckNameAvailabilityReason, + CreatedByType, + DevOpsInfrastructureResourceType, + EphemeralType, + LogonType, + ManagedServiceIdentityType, + Origin, + OsDiskStorageAccountType, + PredictionPreference, + ProvisioningState, + ResourcePredictionsProfileType, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + ResourceStatus, + StorageAccountType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -77,7 +102,10 @@ "AutomaticResourcePredictionsProfile", "AzureDevOpsOrganizationProfile", "AzureDevOpsPermissionProfile", + "CheckNameAvailability", + "CheckNameAvailabilityResult", "DataDisk", + "DeleteResourcesDetails", "DevOpsAzureSku", "ErrorAdditionalInfo", "ErrorDetail", @@ -90,6 +118,8 @@ "ManagedServiceIdentity", "ManualResourcePredictionsProfile", "NetworkProfile", + "Operation", + "OperationDisplay", "Organization", "OrganizationProfile", "OsProfile", @@ -113,6 +143,7 @@ "ResourceSkuRestrictionInfo", "ResourceSkuRestrictions", "ResourceSkuZoneDetails", + "RuntimeConfiguration", "SecretsManagementSettings", "Stateful", "StatelessAgentProfile", @@ -120,12 +151,20 @@ "SystemData", "TrackedResource", "UserAssignedIdentity", + "VmSize", "VmssFabricProfile", + "ActionType", + "AvailabilityStatus", "AzureDevOpsPermissionType", "CachingType", + "CertificateStoreNameOption", + "CheckNameAvailabilityReason", "CreatedByType", + "DevOpsInfrastructureResourceType", + "EphemeralType", "LogonType", "ManagedServiceIdentityType", + "Origin", "OsDiskStorageAccountType", "PredictionPreference", "ProvisioningState", diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_enums.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_enums.py index 4cc4b621cdc8..ae3c142c22ed 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_enums.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_enums.py @@ -19,6 +19,15 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Actions are for internal-only APIs.""" +class AvailabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AvailabilityStatus of a name.""" + + AVAILABLE = "Available" + """The name is available.""" + UNAVAILABLE = "Unavailable" + """The name is unavailable.""" + + class AzureDevOpsPermissionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines who has admin permissions to the Azure DevOps pool.""" @@ -41,6 +50,24 @@ class CachingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For workloads that do a balance of read and write operations.""" +class CertificateStoreNameOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The certificate store name type.""" + + MY = "My" + """The X.509 certificate store for personal certificates.""" + ROOT = "Root" + """The X.509 certificate store for trusted root certificate authorities (CAs).""" + + +class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The reason code explaining why the name is unavailable. Will be null if the name is available.""" + + INVALID = "Invalid" + """The name is invalid.""" + ALREADY_EXISTS = "AlreadyExists" + """The name already exists.""" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of entity that created the resource.""" @@ -54,6 +81,26 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The entity was created by a key.""" +class DevOpsInfrastructureResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of resource.""" + + MICROSOFT_DEV_OPS_INFRASTRUCTURE_POOLS = "Microsoft.DevOpsInfrastructure/pools" + """DevOpsInfrastructure pool resource.""" + + +class EphemeralType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of Ephemeral option the pool will use on underlying VMs when loading this image.""" + + AUTOMATIC = "Automatic" + """Ephemeral is handled by Managed DevOps Pools service.""" + CACHE_DISK = "CacheDisk" + """CacheDisk ephemeral only, requires that the SKU has a cache that is large enough for the image.""" + RESOURCE_DISK = "ResourceDisk" + """ResourceDisk ephemeral only, requires only that the SKU supports it.""" + NV_ME_DISK = "NVMeDisk" + """NVMeDisk ephemeral only, requires that the SKU supports the NVMe DiskControllerType.""" + + class LogonType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines how the service should be run.""" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models.py index c3f6d0644023..6ca4730a2c05 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,25 +6,24 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation import datetime -from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_discriminator, rest_field +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field from ._enums import ResourcePredictionsProfileType if TYPE_CHECKING: from .. import models as _models -class AgentProfile(_model_base.Model): +class AgentProfile(_Model): """The agent profile of the machines in the pool. You probably want to use the sub-classes and not this class directly. Known sub-classes are: Stateful, StatelessAgentProfile - :ivar kind: Discriminator property for AgentProfile. Required. Default value is None. :vartype kind: str :ivar resource_predictions: Defines pool buffer/stand-by agents. @@ -34,13 +33,15 @@ class AgentProfile(_model_base.Model): ~azure.mgmt.devopsinfrastructure.models.ResourcePredictionsProfile """ - __mapping__: Dict[str, _model_base.Model] = {} + __mapping__: dict[str, _Model] = {} kind: str = rest_discriminator(name="kind") """Discriminator property for AgentProfile. Required. Default value is None.""" - resource_predictions: Optional["_models.ResourcePredictions"] = rest_field(name="resourcePredictions") + resource_predictions: Optional["_models.ResourcePredictions"] = rest_field( + name="resourcePredictions", visibility=["read", "create", "update", "delete", "query"] + ) """Defines pool buffer/stand-by agents.""" resource_predictions_profile: Optional["_models.ResourcePredictionsProfile"] = rest_field( - name="resourcePredictionsProfile" + name="resourcePredictionsProfile", visibility=["read", "create", "update", "delete", "query"] ) """Defines how the pool buffer/stand-by agents is provided.""" @@ -60,24 +61,23 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourcePredictionsProfile(_model_base.Model): +class ResourcePredictionsProfile(_Model): """Determines how the stand-by scheme should be provided. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AutomaticResourcePredictionsProfile, ManualResourcePredictionsProfile - :ivar kind: Determines how the stand-by scheme should be provided. Required. Known values are: "Manual" and "Automatic". :vartype kind: str or ~azure.mgmt.devopsinfrastructure.models.ResourcePredictionsProfileType """ - __mapping__: Dict[str, _model_base.Model] = {} - kind: str = rest_discriminator(name="kind") + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) """Determines how the stand-by scheme should be provided. Required. Known values are: \"Manual\" and \"Automatic\".""" @@ -95,14 +95,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class AutomaticResourcePredictionsProfile(ResourcePredictionsProfile, discriminator="Automatic"): """The stand-by agent scheme is determined based on historical demand. - :ivar kind: The stand-by agent scheme is determined based on historical demand. Required. The stand-by agent scheme is determined based on historical demand. :vartype kind: str or ~azure.mgmt.devopsinfrastructure.models.AUTOMATIC @@ -113,11 +112,11 @@ class AutomaticResourcePredictionsProfile(ResourcePredictionsProfile, discrimina ~azure.mgmt.devopsinfrastructure.models.PredictionPreference """ - kind: Literal[ResourcePredictionsProfileType.AUTOMATIC] = rest_discriminator(name="kind") # type: ignore + kind: Literal[ResourcePredictionsProfileType.AUTOMATIC] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The stand-by agent scheme is determined based on historical demand. Required. The stand-by agent scheme is determined based on historical demand.""" prediction_preference: Optional[Union[str, "_models.PredictionPreference"]] = rest_field( - name="predictionPreference" + name="predictionPreference", visibility=["read", "create", "update", "delete", "query"] ) """Determines the balance between cost and performance. Known values are: \"Balanced\", \"MostCostEffective\", \"MoreCostEffective\", \"MorePerformance\", and \"BestPerformance\".""" @@ -136,22 +135,22 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind=ResourcePredictionsProfileType.AUTOMATIC, **kwargs) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = ResourcePredictionsProfileType.AUTOMATIC # type: ignore -class OrganizationProfile(_model_base.Model): +class OrganizationProfile(_Model): """Defines the organization in which the pool will be used. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AzureDevOpsOrganizationProfile, GitHubOrganizationProfile - :ivar kind: Discriminator property for OrganizationProfile. Required. Default value is None. :vartype kind: str """ - __mapping__: Dict[str, _model_base.Model] = {} + __mapping__: dict[str, _Model] = {} kind: str = rest_discriminator(name="kind") """Discriminator property for OrganizationProfile. Required. Default value is None.""" @@ -169,16 +168,20 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class AzureDevOpsOrganizationProfile(OrganizationProfile, discriminator="AzureDevOps"): """Azure DevOps organization profile. - :ivar kind: Azure DevOps organization profile. Required. Default value is "AzureDevOps". :vartype kind: str + :ivar description: An extra description to add to the Azure DevOps pool. + :vartype description: str + :ivar update_description: Determines whether the service updates the Azure DevOps pool + description. + :vartype update_description: bool :ivar organizations: The list of Azure DevOps organizations the pool should be present in. Required. :vartype organizations: list[~azure.mgmt.devopsinfrastructure.models.Organization] @@ -186,21 +189,36 @@ class AzureDevOpsOrganizationProfile(OrganizationProfile, discriminator="AzureDe the Azure DevOps pool. :vartype permission_profile: ~azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionProfile + :ivar alias: An alias to reference the Azure DevOps pool name. + :vartype alias: str """ - kind: Literal["AzureDevOps"] = rest_discriminator(name="kind") # type: ignore + kind: Literal["AzureDevOps"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Azure DevOps organization profile. Required. Default value is \"AzureDevOps\".""" - organizations: List["_models.Organization"] = rest_field() + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An extra description to add to the Azure DevOps pool.""" + update_description: Optional[bool] = rest_field( + name="updateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines whether the service updates the Azure DevOps pool description.""" + organizations: list["_models.Organization"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of Azure DevOps organizations the pool should be present in. Required.""" - permission_profile: Optional["_models.AzureDevOpsPermissionProfile"] = rest_field(name="permissionProfile") + permission_profile: Optional["_models.AzureDevOpsPermissionProfile"] = rest_field( + name="permissionProfile", visibility=["read", "create", "update", "delete", "query"] + ) """The type of permission which determines which accounts are admins on the Azure DevOps pool.""" + alias: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An alias to reference the Azure DevOps pool name.""" @overload def __init__( self, *, - organizations: List["_models.Organization"], + organizations: list["_models.Organization"], + description: Optional[str] = None, + update_description: Optional[bool] = None, permission_profile: Optional["_models.AzureDevOpsPermissionProfile"] = None, + alias: Optional[str] = None, ) -> None: ... @overload @@ -210,14 +228,14 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind="AzureDevOps", **kwargs) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = "AzureDevOps" # type: ignore -class AzureDevOpsPermissionProfile(_model_base.Model): +class AzureDevOpsPermissionProfile(_Model): """Defines the type of Azure DevOps pool permission. - :ivar kind: Determines who has admin permissions to the Azure DevOps pool. Required. Known values are: "Inherit", "CreatorOnly", and "SpecificAccounts". :vartype kind: str or ~azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionType @@ -227,12 +245,14 @@ class AzureDevOpsPermissionProfile(_model_base.Model): :vartype groups: list[str] """ - kind: Union[str, "_models.AzureDevOpsPermissionType"] = rest_field() + kind: Union[str, "_models.AzureDevOpsPermissionType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Determines who has admin permissions to the Azure DevOps pool. Required. Known values are: \"Inherit\", \"CreatorOnly\", and \"SpecificAccounts\".""" - users: Optional[List[str]] = rest_field() + users: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """User email addresses.""" - groups: Optional[List[str]] = rest_field() + groups: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Group email addresses.""" @overload @@ -240,8 +260,97 @@ def __init__( self, *, kind: Union[str, "_models.AzureDevOpsPermissionType"], - users: Optional[List[str]] = None, - groups: Optional[List[str]] = None, + users: Optional[list[str]] = None, + groups: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailability(_Model): + """The parameters used to check the availability of a resource. + + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar type: The type of resource that is used as the scope of the availability check. Required. + "Microsoft.DevOpsInfrastructure/pools" + :vartype type: str or ~azure.mgmt.devopsinfrastructure.models.DevOpsInfrastructureResourceType + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the resource. Required.""" + type: Union[str, "_models.DevOpsInfrastructureResourceType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of resource that is used as the scope of the availability check. Required. + \"Microsoft.DevOpsInfrastructure/pools\"""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.DevOpsInfrastructureResourceType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityResult(_Model): + """The CheckNameAvailability operation response. + + :ivar available: Availability status of the name. Required. Known values are: "Available" and + "Unavailable". + :vartype available: str or ~azure.mgmt.devopsinfrastructure.models.AvailabilityStatus + :ivar message: A message explaining why the name is unavailable. Will be null if the name is + available. Required. + :vartype message: str + :ivar name: The name whose availability was checked. Required. + :vartype name: str + :ivar reason: The reason code explaining why the name is unavailable. Will be null if the name + is available. Required. Known values are: "Invalid" and "AlreadyExists". + :vartype reason: str or ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityReason + """ + + available: Union[str, "_models.AvailabilityStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Availability status of the name. Required. Known values are: \"Available\" and \"Unavailable\".""" + message: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A message explaining why the name is unavailable. Will be null if the name is available. + Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name whose availability was checked. Required.""" + reason: Union[str, "_models.CheckNameAvailabilityReason"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The reason code explaining why the name is unavailable. Will be null if the name is available. + Required. Known values are: \"Invalid\" and \"AlreadyExists\".""" + + @overload + def __init__( + self, + *, + available: Union[str, "_models.AvailabilityStatus"], + message: str, + name: str, + reason: Union[str, "_models.CheckNameAvailabilityReason"], ) -> None: ... @overload @@ -251,16 +360,17 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DataDisk(_model_base.Model): +class DataDisk(_Model): """The data disk of the VMSS. :ivar caching: The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: - https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + `https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/ + `_. Known values are: "None", "ReadOnly", and "ReadWrite". :vartype caching: str or ~azure.mgmt.devopsinfrastructure.models.CachingType :ivar disk_size_gi_b: The initial disk size in gigabytes. @@ -275,18 +385,27 @@ class DataDisk(_model_base.Model): :vartype drive_letter: str """ - caching: Optional[Union[str, "_models.CachingType"]] = rest_field() + caching: Optional[Union[str, "_models.CachingType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: - https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + `https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/ + `_. Known values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" - disk_size_gi_b: Optional[int] = rest_field(name="diskSizeGiB") + disk_size_gi_b: Optional[int] = rest_field( + name="diskSizeGiB", visibility=["read", "create", "update", "delete", "query"] + ) """The initial disk size in gigabytes.""" - storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = rest_field(name="storageAccountType") + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = rest_field( + name="storageAccountType", visibility=["read", "create", "update", "delete", "query"] + ) """The storage Account type to be used for the data disk. If omitted, the default is \"standard_lrs\". Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", \"Premium_ZRS\", and \"StandardSSD_ZRS\".""" - drive_letter: Optional[str] = rest_field(name="driveLetter") + drive_letter: Optional[str] = rest_field( + name="driveLetter", visibility=["read", "create", "update", "delete", "query"] + ) """The drive letter for the empty data disk. If not specified, it will be the first available letter.""" @@ -307,26 +426,78 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DevOpsAzureSku(_model_base.Model): - """The Azure SKU of the machines in the pool. +class DeleteResourcesDetails(_Model): + """Request body for deleting many resources by their IDs. + + :ivar resource_ids: List of resource IDs to delete. Required. + :vartype resource_ids: list[str] + """ + + resource_ids: list[str] = rest_field(name="resourceIds", visibility=["read", "create", "update", "delete", "query"]) + """List of resource IDs to delete. Required.""" + @overload + def __init__( + self, + *, + resource_ids: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DevOpsAzureSku(_Model): + """The Azure SKU of the machines in the pool. :ivar name: The Azure SKU name of the machines in the pool. Required. :vartype name: str + :ivar windows_nvme_drive: The drive letter for the NVMe striped volume on Windows (e.g., 'N'). + Defaults to 'N' when not specified. + :vartype windows_nvme_drive: str + :ivar linux_nvme_path: The mount path for the NVMe striped volume on Linux (e.g., + '/mnt/azure_nvme_temp'). Defaults to '/mnt/azure_nvme_temp' when not specified. + :vartype linux_nvme_path: str + :ivar vm_sizes: Specifies VM sizes for instance-mix allocation. + :vartype vm_sizes: list[~azure.mgmt.devopsinfrastructure.models.VmSize] """ - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The Azure SKU name of the machines in the pool. Required.""" + windows_nvme_drive: Optional[str] = rest_field( + name="windowsNvmeDrive", visibility=["read", "create", "update", "delete", "query"] + ) + """The drive letter for the NVMe striped volume on Windows (e.g., 'N'). Defaults to 'N' when not + specified.""" + linux_nvme_path: Optional[str] = rest_field( + name="linuxNvmePath", visibility=["read", "create", "update", "delete", "query"] + ) + """The mount path for the NVMe striped volume on Linux (e.g., '/mnt/azure_nvme_temp'). Defaults to + '/mnt/azure_nvme_temp' when not specified.""" + vm_sizes: Optional[list["_models.VmSize"]] = rest_field( + name="vmSizes", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies VM sizes for instance-mix allocation.""" @overload def __init__( self, *, name: str, + windows_nvme_drive: Optional[str] = None, + linux_nvme_path: Optional[str] = None, + vm_sizes: Optional[list["_models.VmSize"]] = None, ) -> None: ... @overload @@ -336,15 +507,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ErrorAdditionalInfo(_model_base.Model): +class ErrorAdditionalInfo(_Model): """The resource management error additional info. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. @@ -357,11 +526,9 @@ class ErrorAdditionalInfo(_model_base.Model): """The additional info.""" -class ErrorDetail(_model_base.Model): +class ErrorDetail(_Model): """The error detail. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: The error code. :vartype code: str :ivar message: The error message. @@ -380,23 +547,22 @@ class ErrorDetail(_model_base.Model): """The error message.""" target: Optional[str] = rest_field(visibility=["read"]) """The error target.""" - details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) """The error details.""" - additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( name="additionalInfo", visibility=["read"] ) """The error additional info.""" -class ErrorResponse(_model_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. +class ErrorResponse(_Model): + """Error response. :ivar error: The error object. :vartype error: ~azure.mgmt.devopsinfrastructure.models.ErrorDetail """ - error: Optional["_models.ErrorDetail"] = rest_field() + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The error object.""" @overload @@ -413,22 +579,21 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricProfile(_model_base.Model): +class FabricProfile(_Model): """Defines the type of fabric the agent will run on. You probably want to use the sub-classes and not this class directly. Known sub-classes are: VmssFabricProfile - :ivar kind: Discriminator property for FabricProfile. Required. Default value is None. :vartype kind: str """ - __mapping__: Dict[str, _model_base.Model] = {} + __mapping__: dict[str, _Model] = {} kind: str = rest_discriminator(name="kind") """Discriminator property for FabricProfile. Required. Default value is None.""" @@ -446,23 +611,22 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GitHubOrganization(_model_base.Model): +class GitHubOrganization(_Model): """Defines a GitHub organization. - :ivar url: The GitHub organization URL in which the pool should be created. Required. :vartype url: str :ivar repositories: Optional list of repositories in which the pool should be created. :vartype repositories: list[str] """ - url: str = rest_field() + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The GitHub organization URL in which the pool should be created. Required.""" - repositories: Optional[List[str]] = rest_field() + repositories: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional list of repositories in which the pool should be created.""" @overload @@ -470,7 +634,7 @@ def __init__( self, *, url: str, - repositories: Optional[List[str]] = None, + repositories: Optional[list[str]] = None, ) -> None: ... @overload @@ -480,14 +644,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class GitHubOrganizationProfile(OrganizationProfile, discriminator="GitHub"): """GitHub organization profile. - :ivar kind: GitHub organization profile. Required. Default value is "GitHub". :vartype kind: str :ivar organizations: The list of GitHub organizations/repositories the pool should be present @@ -495,16 +658,18 @@ class GitHubOrganizationProfile(OrganizationProfile, discriminator="GitHub"): :vartype organizations: list[~azure.mgmt.devopsinfrastructure.models.GitHubOrganization] """ - kind: Literal["GitHub"] = rest_discriminator(name="kind") # type: ignore + kind: Literal["GitHub"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """GitHub organization profile. Required. Default value is \"GitHub\".""" - organizations: List["_models.GitHubOrganization"] = rest_field() + organizations: list["_models.GitHubOrganization"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The list of GitHub organizations/repositories the pool should be present in. Required.""" @overload def __init__( self, *, - organizations: List["_models.GitHubOrganization"], + organizations: list["_models.GitHubOrganization"], ) -> None: ... @overload @@ -514,17 +679,16 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind="GitHub", **kwargs) - + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = "GitHub" # type: ignore -class Resource(_model_base.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Resource(_Model): + """Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -538,7 +702,7 @@ class Resource(_model_base.Model): id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" name: Optional[str] = rest_field(visibility=["read"]) """The name of the resource.""" type: Optional[str] = rest_field(visibility=["read"]) @@ -549,13 +713,10 @@ class Resource(_model_base.Model): class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Readonly variables are only populated by the server, and will be ignored when sending a request. + """Proxy Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -571,10 +732,8 @@ class ProxyResource(Resource): class ImageVersion(ProxyResource): """An image version object. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -588,7 +747,9 @@ class ImageVersion(ProxyResource): :vartype properties: ~azure.mgmt.devopsinfrastructure.models.ImageVersionProperties """ - properties: Optional["_models.ImageVersionProperties"] = rest_field() + properties: Optional["_models.ImageVersionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -605,19 +766,18 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ImageVersionProperties(_model_base.Model): +class ImageVersionProperties(_Model): """Details of the ImageVersionProperties. - :ivar version: Version of the image. Required. :vartype version: str """ - version: str = rest_field() + version: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Version of the image. Required.""" @overload @@ -634,16 +794,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedServiceIdentity(_model_base.Model): +class ManagedServiceIdentity(_Model): """Managed service identity (system assigned and/or user assigned identities). - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. :vartype principal_id: str @@ -664,11 +821,13 @@ class ManagedServiceIdentity(_model_base.Model): tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) """The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.""" - type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field() + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The type of managed identity assigned to this resource. Required. Known values are: \"None\", \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( - name="userAssignedIdentities" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] ) """The identities assigned to this resource by the user.""" @@ -677,7 +836,7 @@ def __init__( self, *, type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, ) -> None: ... @overload @@ -687,20 +846,19 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class ManualResourcePredictionsProfile(ResourcePredictionsProfile, discriminator="Manual"): """Customer provides the stand-by agent scheme. - :ivar kind: Customer provides the stand-by agent scheme. Required. Customer provides the stand-by agent scheme. :vartype kind: str or ~azure.mgmt.devopsinfrastructure.models.MANUAL """ - kind: Literal[ResourcePredictionsProfileType.MANUAL] = rest_discriminator(name="kind") # type: ignore + kind: Literal[ResourcePredictionsProfileType.MANUAL] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Customer provides the stand-by agent scheme. Required. Customer provides the stand-by agent scheme.""" @@ -716,26 +874,40 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind=ResourcePredictionsProfileType.MANUAL, **kwargs) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = ResourcePredictionsProfileType.MANUAL # type: ignore -class NetworkProfile(_model_base.Model): +class NetworkProfile(_Model): """The network profile of the machines in the pool. - - :ivar subnet_id: The subnet id on which to put all machines created in the pool. Required. + :ivar subnet_id: The subnet id on which to put all machines created in the pool. :vartype subnet_id: str + :ivar static_ip_address_count: The number of static public IP addresses for outgoing + connections assigned to the pool. + :vartype static_ip_address_count: int + :ivar ip_addresses: Read only. The list of static public IP addresses for outgoing connections + assigned to the pool. + :vartype ip_addresses: list[str] """ - subnet_id: str = rest_field(name="subnetId") - """The subnet id on which to put all machines created in the pool. Required.""" + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + """The subnet id on which to put all machines created in the pool.""" + static_ip_address_count: Optional[int] = rest_field( + name="staticIpAddressCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of static public IP addresses for outgoing connections assigned to the pool.""" + ip_addresses: Optional[list[str]] = rest_field(name="ipAddresses", visibility=["read"]) + """Read only. The list of static public IP addresses for outgoing connections assigned to the + pool.""" @overload def __init__( self, *, - subnet_id: str, + subnet_id: Optional[str] = None, + static_ip_address_count: Optional[int] = None, ) -> None: ... @overload @@ -745,14 +917,12 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Operation(_Model): + """REST API Operation. :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". @@ -761,7 +931,7 @@ class Operation(_model_base.Model): data-plane operations and "false" for Azure Resource Manager/control-plane operations. :vartype is_data_action: bool :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.devopsinfrastructure.models._models.OperationDisplay + :vartype display: ~azure.mgmt.devopsinfrastructure.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", and "user,system". @@ -778,21 +948,38 @@ class Operation(_model_base.Model): is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models._models.OperationDisplay"] = rest_field(visibility=["read"]) + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Localized display information for this particular operation.""" - origin: Optional[Union[str, "_models._enums.Origin"]] = rest_field(visibility=["read"]) + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and \"user,system\".""" - action_type: Optional[Union[str, "_models._enums.ActionType"]] = rest_field(name="actionType") + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs. \"Internal\"""" + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... -class OperationDisplay(_model_base.Model): - """Localized display information for and operation. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - Readonly variables are only populated by the server, and will be ignored when sending a request. + +class OperationDisplay(_Model): + """Localized display information for an operation. :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". @@ -822,10 +1009,9 @@ class OperationDisplay(_model_base.Model): views.""" -class Organization(_model_base.Model): +class Organization(_Model): """Defines an Azure DevOps organization. - :ivar url: The Azure DevOps organization URL in which the pool should be created. Required. :vartype url: str :ivar projects: Optional list of projects in which the pool should be created. @@ -833,23 +1019,36 @@ class Organization(_model_base.Model): :ivar parallelism: How many machines can be created at maximum in this organization out of the maximumConcurrency of the pool. :vartype parallelism: int + :ivar open_access: Determines if the pool should have open access to all projects in this + organization. + :vartype open_access: bool + :ivar alias: An alias to reference the Azure DevOps pool name. + :vartype alias: str """ - url: str = rest_field() + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The Azure DevOps organization URL in which the pool should be created. Required.""" - projects: Optional[List[str]] = rest_field() + projects: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional list of projects in which the pool should be created.""" - parallelism: Optional[int] = rest_field() + parallelism: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """How many machines can be created at maximum in this organization out of the maximumConcurrency of the pool.""" + open_access: Optional[bool] = rest_field( + name="openAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines if the pool should have open access to all projects in this organization.""" + alias: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An alias to reference the Azure DevOps pool name.""" @overload def __init__( self, *, url: str, - projects: Optional[List[str]] = None, + projects: Optional[list[str]] = None, parallelism: Optional[int] = None, + open_access: Optional[bool] = None, + alias: Optional[str] = None, ) -> None: ... @overload @@ -859,11 +1058,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OsProfile(_model_base.Model): +class OsProfile(_Model): """The OS profile of the machines in the pool. :ivar secrets_management_settings: The secret management settings of the machines in the pool. @@ -875,10 +1074,12 @@ class OsProfile(_model_base.Model): """ secrets_management_settings: Optional["_models.SecretsManagementSettings"] = rest_field( - name="secretsManagementSettings" + name="secretsManagementSettings", visibility=["read", "create", "update", "delete", "query"] ) """The secret management settings of the machines in the pool.""" - logon_type: Optional[Union[str, "_models.LogonType"]] = rest_field(name="logonType") + logon_type: Optional[Union[str, "_models.LogonType"]] = rest_field( + name="logonType", visibility=["read", "create", "update", "delete", "query"] + ) """Determines how the service should be run. By default, this will be set to Service. Known values are: \"Service\" and \"Interactive\".""" @@ -897,19 +1098,15 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - + """Tracked Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -925,7 +1122,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -935,7 +1132,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, ) -> None: ... @overload @@ -945,7 +1142,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -953,11 +1150,8 @@ class Pool(TrackedResource): """Concrete tracked resource types can be created by aliasing this type using a specific property type. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -977,9 +1171,13 @@ class Pool(TrackedResource): :vartype identity: ~azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity """ - properties: Optional["_models.PoolProperties"] = rest_field() + properties: Optional["_models.PoolProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" - identity: Optional["_models.ManagedServiceIdentity"] = rest_field() + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The managed service identities assigned to this resource.""" @overload @@ -987,7 +1185,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.PoolProperties"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @@ -999,11 +1197,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PoolImage(_model_base.Model): +class PoolImage(_Model): """The VM image of the machines in the pool. :ivar resource_id: The resource id of the image. @@ -1015,16 +1213,60 @@ class PoolImage(_model_base.Model): :vartype aliases: list[str] :ivar buffer: The percentage of the buffer to be allocated to this image. :vartype buffer: str + :ivar ephemeral_type: The ephemeral type of the image. Known values are: "Automatic", + "CacheDisk", "ResourceDisk", and "NVMeDisk". + :vartype ephemeral_type: str or ~azure.mgmt.devopsinfrastructure.models.EphemeralType + :ivar is_ephemeral: Read only. Determines if the image is ephemeral. + :vartype is_ephemeral: bool + :ivar provisioning_script_storage_account_resource_id: The ARM resource ID of the storage + account hosting provisioning scripts for this image. + :vartype provisioning_script_storage_account_resource_id: str + :ivar provisioning_script_managed_identity_client_id: The managed identity client ID used to + access provisioning script content for this image. + :vartype provisioning_script_managed_identity_client_id: str + :ivar provisioning_script_should_restart: Determines whether the machine should be restarted + after provisioning script execution for this image. + :vartype provisioning_script_should_restart: bool + :ivar provisioning_script_entry_point: The provisioning script entry point for this image. + :vartype provisioning_script_entry_point: str """ - resource_id: Optional[str] = rest_field(name="resourceId") + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) """The resource id of the image.""" - well_known_image_name: Optional[str] = rest_field(name="wellKnownImageName") + well_known_image_name: Optional[str] = rest_field( + name="wellKnownImageName", visibility=["read", "create", "update", "delete", "query"] + ) """The image to use from a well-known set of images made available to customers.""" - aliases: Optional[List[str]] = rest_field() + aliases: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """List of aliases to reference the image by.""" - buffer: Optional[str] = rest_field() + buffer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The percentage of the buffer to be allocated to this image.""" + ephemeral_type: Optional[Union[str, "_models.EphemeralType"]] = rest_field( + name="ephemeralType", visibility=["read", "create", "update", "delete", "query"] + ) + """The ephemeral type of the image. Known values are: \"Automatic\", \"CacheDisk\", + \"ResourceDisk\", and \"NVMeDisk\".""" + is_ephemeral: Optional[bool] = rest_field(name="isEphemeral", visibility=["read"]) + """Read only. Determines if the image is ephemeral.""" + provisioning_script_storage_account_resource_id: Optional[str] = rest_field( + name="provisioningScriptStorageAccountResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM resource ID of the storage account hosting provisioning scripts for this image.""" + provisioning_script_managed_identity_client_id: Optional[str] = rest_field( + name="provisioningScriptManagedIdentityClientId", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed identity client ID used to access provisioning script content for this image.""" + provisioning_script_should_restart: Optional[bool] = rest_field( + name="provisioningScriptShouldRestart", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines whether the machine should be restarted after provisioning script execution for this + image.""" + provisioning_script_entry_point: Optional[str] = rest_field( + name="provisioningScriptEntryPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The provisioning script entry point for this image.""" @overload def __init__( @@ -1032,8 +1274,13 @@ def __init__( *, resource_id: Optional[str] = None, well_known_image_name: Optional[str] = None, - aliases: Optional[List[str]] = None, + aliases: Optional[list[str]] = None, buffer: Optional[str] = None, + ephemeral_type: Optional[Union[str, "_models.EphemeralType"]] = None, + provisioning_script_storage_account_resource_id: Optional[str] = None, + provisioning_script_managed_identity_client_id: Optional[str] = None, + provisioning_script_should_restart: Optional[bool] = None, + provisioning_script_entry_point: Optional[str] = None, ) -> None: ... @overload @@ -1043,14 +1290,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PoolProperties(_model_base.Model): +class PoolProperties(_Model): """Pool properties. - :ivar provisioning_state: The status of the current operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.devopsinfrastructure.models.ProvisioningState @@ -1064,23 +1310,41 @@ class PoolProperties(_model_base.Model): :ivar fabric_profile: Defines the type of fabric the agent will run on. Required. :vartype fabric_profile: ~azure.mgmt.devopsinfrastructure.models.FabricProfile :ivar dev_center_project_resource_id: The resource id of the DevCenter Project the pool belongs - to. Required. + to. :vartype dev_center_project_resource_id: str + :ivar runtime_configuration: The runtime configuration of the pool. + :vartype runtime_configuration: ~azure.mgmt.devopsinfrastructure.models.RuntimeConfiguration """ - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(name="provisioningState") + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) """The status of the current operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - maximum_concurrency: int = rest_field(name="maximumConcurrency") + maximum_concurrency: int = rest_field( + name="maximumConcurrency", visibility=["read", "create", "update", "delete", "query"] + ) """Defines how many resources can there be created at any given time. Required.""" - organization_profile: "_models.OrganizationProfile" = rest_field(name="organizationProfile") + organization_profile: "_models.OrganizationProfile" = rest_field( + name="organizationProfile", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the organization in which the pool will be used. Required.""" - agent_profile: "_models.AgentProfile" = rest_field(name="agentProfile") + agent_profile: "_models.AgentProfile" = rest_field( + name="agentProfile", visibility=["read", "create", "update", "delete", "query"] + ) """Defines how the machine will be handled once it executed a job. Required.""" - fabric_profile: "_models.FabricProfile" = rest_field(name="fabricProfile") + fabric_profile: "_models.FabricProfile" = rest_field( + name="fabricProfile", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the type of fabric the agent will run on. Required.""" - dev_center_project_resource_id: str = rest_field(name="devCenterProjectResourceId") - """The resource id of the DevCenter Project the pool belongs to. Required.""" + dev_center_project_resource_id: Optional[str] = rest_field( + name="devCenterProjectResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the DevCenter Project the pool belongs to.""" + runtime_configuration: Optional["_models.RuntimeConfiguration"] = rest_field( + name="runtimeConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The runtime configuration of the pool.""" @overload def __init__( @@ -1090,8 +1354,9 @@ def __init__( organization_profile: "_models.OrganizationProfile", agent_profile: "_models.AgentProfile", fabric_profile: "_models.FabricProfile", - dev_center_project_resource_id: str, provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + dev_center_project_resource_id: Optional[str] = None, + runtime_configuration: Optional["_models.RuntimeConfiguration"] = None, ) -> None: ... @overload @@ -1101,11 +1366,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PoolUpdate(_model_base.Model): +class PoolUpdate(_Model): """The type used for update operations of the Pool. :ivar identity: The managed service identities assigned to this resource. @@ -1116,11 +1381,15 @@ class PoolUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdateProperties """ - identity: Optional["_models.ManagedServiceIdentity"] = rest_field() + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The managed service identities assigned to this resource.""" - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - properties: Optional["_models.PoolUpdateProperties"] = rest_field() + properties: Optional["_models.PoolUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -1128,7 +1397,7 @@ def __init__( self, *, identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.PoolUpdateProperties"] = None, ) -> None: ... @@ -1139,11 +1408,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PoolUpdateProperties(_model_base.Model): +class PoolUpdateProperties(_Model): """The updatable properties of the Pool. :ivar provisioning_state: The status of the current operation. Known values are: "Succeeded", @@ -1160,21 +1429,39 @@ class PoolUpdateProperties(_model_base.Model): :ivar dev_center_project_resource_id: The resource id of the DevCenter Project the pool belongs to. :vartype dev_center_project_resource_id: str + :ivar runtime_configuration: The runtime configuration of the pool. + :vartype runtime_configuration: ~azure.mgmt.devopsinfrastructure.models.RuntimeConfiguration """ - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(name="provisioningState") + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) """The status of the current operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - maximum_concurrency: Optional[int] = rest_field(name="maximumConcurrency") + maximum_concurrency: Optional[int] = rest_field( + name="maximumConcurrency", visibility=["read", "create", "update", "delete", "query"] + ) """Defines how many resources can there be created at any given time.""" - organization_profile: Optional["_models.OrganizationProfile"] = rest_field(name="organizationProfile") + organization_profile: Optional["_models.OrganizationProfile"] = rest_field( + name="organizationProfile", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the organization in which the pool will be used.""" - agent_profile: Optional["_models.AgentProfile"] = rest_field(name="agentProfile") + agent_profile: Optional["_models.AgentProfile"] = rest_field( + name="agentProfile", visibility=["read", "create", "update", "delete", "query"] + ) """Defines how the machine will be handled once it executed a job.""" - fabric_profile: Optional["_models.FabricProfile"] = rest_field(name="fabricProfile") + fabric_profile: Optional["_models.FabricProfile"] = rest_field( + name="fabricProfile", visibility=["read", "create", "update", "delete", "query"] + ) """Defines the type of fabric the agent will run on.""" - dev_center_project_resource_id: Optional[str] = rest_field(name="devCenterProjectResourceId") + dev_center_project_resource_id: Optional[str] = rest_field( + name="devCenterProjectResourceId", visibility=["read", "create", "update", "delete", "query"] + ) """The resource id of the DevCenter Project the pool belongs to.""" + runtime_configuration: Optional["_models.RuntimeConfiguration"] = rest_field( + name="runtimeConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The runtime configuration of the pool.""" @overload def __init__( @@ -1186,6 +1473,7 @@ def __init__( agent_profile: Optional["_models.AgentProfile"] = None, fabric_profile: Optional["_models.FabricProfile"] = None, dev_center_project_resource_id: Optional[str] = None, + runtime_configuration: Optional["_models.RuntimeConfiguration"] = None, ) -> None: ... @overload @@ -1195,16 +1483,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Quota(_model_base.Model): +class Quota(_Model): """Describes Resource Quota. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the quota. :vartype name: ~azure.mgmt.devopsinfrastructure.models.QuotaName :ivar id: Fully qualified ARM resource id. Required. @@ -1219,13 +1504,13 @@ class Quota(_model_base.Model): name: Optional["_models.QuotaName"] = rest_field(visibility=["read"]) """The name of the quota.""" - id: str = rest_field() + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Fully qualified ARM resource id. Required.""" - unit: str = rest_field() + unit: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The unit of usage measurement. Required.""" - current_value: int = rest_field(name="currentValue") + current_value: int = rest_field(name="currentValue", visibility=["read", "create", "update", "delete", "query"]) """The current usage of the resource. Required.""" - limit: int = rest_field() + limit: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The maximum permitted usage of the resource. Required.""" @overload @@ -1245,11 +1530,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class QuotaName(_model_base.Model): +class QuotaName(_Model): """The Quota Names. :ivar value: The name of the resource. @@ -1258,9 +1543,11 @@ class QuotaName(_model_base.Model): :vartype localized_value: str """ - value: Optional[str] = rest_field() + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the resource.""" - localized_value: Optional[str] = rest_field(name="localizedValue") + localized_value: Optional[str] = rest_field( + name="localizedValue", visibility=["read", "create", "update", "delete", "query"] + ) """The localized name of the resource.""" @overload @@ -1278,17 +1565,15 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class ResourceDetailsObject(ProxyResource): """A ResourceDetailsObject. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1302,7 +1587,9 @@ class ResourceDetailsObject(ProxyResource): :vartype properties: ~azure.mgmt.devopsinfrastructure.models.ResourceDetailsObjectProperties """ - properties: Optional["_models.ResourceDetailsObjectProperties"] = rest_field() + properties: Optional["_models.ResourceDetailsObjectProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -1319,14 +1606,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceDetailsObjectProperties(_model_base.Model): +class ResourceDetailsObjectProperties(_Model): """Details of the ResourceDetailsObject. - :ivar status: The status of the resource. Required. Known values are: "Ready", "NotReady", "Allocated", "PendingReturn", "Returned", "Leased", "Provisioning", "Updating", "Starting", "PendingReimage", and "Reimaging". @@ -1337,13 +1623,15 @@ class ResourceDetailsObjectProperties(_model_base.Model): :vartype image_version: str """ - status: Union[str, "_models.ResourceStatus"] = rest_field() + status: Union[str, "_models.ResourceStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The status of the resource. Required. Known values are: \"Ready\", \"NotReady\", \"Allocated\", \"PendingReturn\", \"Returned\", \"Leased\", \"Provisioning\", \"Updating\", \"Starting\", \"PendingReimage\", and \"Reimaging\".""" - image: str = rest_field() + image: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The image name of the resource. Required.""" - image_version: str = rest_field(name="imageVersion") + image_version: str = rest_field(name="imageVersion", visibility=["read", "create", "update", "delete", "query"]) """The version of the image running on the resource. Required.""" @overload @@ -1362,21 +1650,19 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourcePredictions(_model_base.Model): +class ResourcePredictions(_Model): """Defines pool buffer.""" class ResourceSku(ProxyResource): """A ResourceSku. - Readonly 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1390,7 +1676,9 @@ class ResourceSku(ProxyResource): :vartype properties: ~azure.mgmt.devopsinfrastructure.models.ResourceSkuProperties """ - properties: Optional["_models.ResourceSkuProperties"] = rest_field() + properties: Optional["_models.ResourceSkuProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -1407,23 +1695,22 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceSkuCapabilities(_model_base.Model): +class ResourceSkuCapabilities(_Model): """Describes The SKU capabilities object. - :ivar name: The name of the SKU capability. Required. :vartype name: str :ivar value: The value of the SKU capability. Required. :vartype value: str """ - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the SKU capability. Required.""" - value: str = rest_field() + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The value of the SKU capability. Required.""" @overload @@ -1441,14 +1728,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceSkuLocationInfo(_model_base.Model): +class ResourceSkuLocationInfo(_Model): """Describes an available Compute SKU Location Information. - :ivar location: Location of the SKU. Required. :vartype location: str :ivar zones: List of availability zones where the SKU is supported. Required. @@ -1458,11 +1744,13 @@ class ResourceSkuLocationInfo(_model_base.Model): :vartype zone_details: list[~azure.mgmt.devopsinfrastructure.models.ResourceSkuZoneDetails] """ - location: str = rest_field() + location: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Location of the SKU. Required.""" - zones: List[str] = rest_field() + zones: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """List of availability zones where the SKU is supported. Required.""" - zone_details: List["_models.ResourceSkuZoneDetails"] = rest_field(name="zoneDetails") + zone_details: list["_models.ResourceSkuZoneDetails"] = rest_field( + name="zoneDetails", visibility=["read", "create", "update", "delete", "query"] + ) """Gets details of capabilities available to a SKU in specific zones. Required.""" @overload @@ -1470,8 +1758,8 @@ def __init__( self, *, location: str, - zones: List[str], - zone_details: List["_models.ResourceSkuZoneDetails"], + zones: list[str], + zone_details: list["_models.ResourceSkuZoneDetails"], ) -> None: ... @overload @@ -1481,14 +1769,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceSkuProperties(_model_base.Model): +class ResourceSkuProperties(_Model): """Properties of a ResourceSku. - :ivar resource_type: The type of resource the SKU applies to. Required. :vartype resource_type: str :ivar tier: The tier of virtual machines in a scale set. Required. @@ -1508,22 +1795,28 @@ class ResourceSkuProperties(_model_base.Model): :vartype restrictions: list[~azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictions] """ - resource_type: str = rest_field(name="resourceType") + resource_type: str = rest_field(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) """The type of resource the SKU applies to. Required.""" - tier: str = rest_field() + tier: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The tier of virtual machines in a scale set. Required.""" - size: str = rest_field() + size: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The size of the SKU. Required.""" - family: str = rest_field() + family: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The family of the SKU. Required.""" - locations: List[str] = rest_field() + locations: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The set of locations that the SKU is available. Required.""" - location_info: List["_models.ResourceSkuLocationInfo"] = rest_field(name="locationInfo") + location_info: list["_models.ResourceSkuLocationInfo"] = rest_field( + name="locationInfo", visibility=["read", "create", "update", "delete", "query"] + ) """A list of locations and availability zones in those locations where the SKU is available. Required.""" - capabilities: List["_models.ResourceSkuCapabilities"] = rest_field() + capabilities: list["_models.ResourceSkuCapabilities"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Name value pairs to describe the capability. Required.""" - restrictions: List["_models.ResourceSkuRestrictions"] = rest_field() + restrictions: list["_models.ResourceSkuRestrictions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The restrictions of the SKU. Required.""" @overload @@ -1534,10 +1827,10 @@ def __init__( tier: str, size: str, family: str, - locations: List[str], - location_info: List["_models.ResourceSkuLocationInfo"], - capabilities: List["_models.ResourceSkuCapabilities"], - restrictions: List["_models.ResourceSkuRestrictions"], + locations: list[str], + location_info: list["_models.ResourceSkuLocationInfo"], + capabilities: list["_models.ResourceSkuCapabilities"], + restrictions: list["_models.ResourceSkuRestrictions"], ) -> None: ... @overload @@ -1547,11 +1840,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceSkuRestrictionInfo(_model_base.Model): +class ResourceSkuRestrictionInfo(_Model): """Describes an available Compute SKU Restriction Information. :ivar locations: Locations where the SKU is restricted. @@ -1560,17 +1853,17 @@ class ResourceSkuRestrictionInfo(_model_base.Model): :vartype zones: list[str] """ - locations: Optional[List[str]] = rest_field() + locations: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Locations where the SKU is restricted.""" - zones: Optional[List[str]] = rest_field() + zones: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """List of availability zones where the SKU is restricted.""" @overload def __init__( self, *, - locations: Optional[List[str]] = None, - zones: Optional[List[str]] = None, + locations: Optional[list[str]] = None, + zones: Optional[list[str]] = None, ) -> None: ... @overload @@ -1580,14 +1873,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceSkuRestrictions(_model_base.Model): +class ResourceSkuRestrictions(_Model): """The restrictions of the SKU. - :ivar type: the type of restrictions. Known values are: "Location" and "Zone". :vartype type: str or ~azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionsType :ivar values_property: The value of restrictions. If the restriction type is set to location. @@ -1602,21 +1894,29 @@ class ResourceSkuRestrictions(_model_base.Model): ~azure.mgmt.devopsinfrastructure.models.ResourceSkuRestrictionsReasonCode """ - type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = rest_field() + type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """the type of restrictions. Known values are: \"Location\" and \"Zone\".""" - values_property: List[str] = rest_field(name="values") + values_property: list[str] = rest_field( + name="values", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="values" + ) """The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. Required.""" - restriction_info: "_models.ResourceSkuRestrictionInfo" = rest_field(name="restrictionInfo") + restriction_info: "_models.ResourceSkuRestrictionInfo" = rest_field( + name="restrictionInfo", visibility=["read", "create", "update", "delete", "query"] + ) """The information about the restriction where the SKU cannot be used. Required.""" - reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = rest_field(name="reasonCode") + reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = rest_field( + name="reasonCode", visibility=["read", "create", "update", "delete", "query"] + ) """the reason for restriction. Known values are: \"QuotaId\" and \"NotAvailableForSubscription\".""" @overload def __init__( self, *, - values_property: List[str], + values_property: list[str], restriction_info: "_models.ResourceSkuRestrictionInfo", type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, @@ -1629,14 +1929,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceSkuZoneDetails(_model_base.Model): +class ResourceSkuZoneDetails(_Model): """Describes The zonal capabilities of a SKU. - :ivar name: Gets the set of zones that the SKU is available in with the specified capabilities. Required. :vartype name: list[str] @@ -1645,17 +1944,19 @@ class ResourceSkuZoneDetails(_model_base.Model): :vartype capabilities: list[~azure.mgmt.devopsinfrastructure.models.ResourceSkuCapabilities] """ - name: List[str] = rest_field() + name: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Gets the set of zones that the SKU is available in with the specified capabilities. Required.""" - capabilities: List["_models.ResourceSkuCapabilities"] = rest_field() + capabilities: list["_models.ResourceSkuCapabilities"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """A list of capabilities that are available for the SKU in the specified list of zones. Required.""" @overload def __init__( self, *, - name: List[str], - capabilities: List["_models.ResourceSkuCapabilities"], + name: list[str], + capabilities: list["_models.ResourceSkuCapabilities"], ) -> None: ... @overload @@ -1665,16 +1966,49 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SecretsManagementSettings(_model_base.Model): - """The secret management settings of the machines in the pool. +class RuntimeConfiguration(_Model): + """The runtime configuration of the pool. + + :ivar work_folder: The target work folder of the task agent on the machine. + :vartype work_folder: str + """ + + work_folder: Optional[str] = rest_field( + name="workFolder", visibility=["read", "create", "update", "delete", "query"] + ) + """The target work folder of the task agent on the machine.""" + + @overload + def __init__( + self, + *, + work_folder: Optional[str] = None, + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecretsManagementSettings(_Model): + """The secret management settings of the machines in the pool. :ivar certificate_store_location: Where to store certificates on the machine. :vartype certificate_store_location: str + :ivar certificate_store_name: Name of the certificate store to use on the machine, currently + 'My' and 'Root' are supported. Known values are: "My" and "Root". + :vartype certificate_store_name: str or + ~azure.mgmt.devopsinfrastructure.models.CertificateStoreNameOption :ivar observed_certificates: The list of certificates to install on all machines in the pool. Required. :vartype observed_certificates: list[str] @@ -1682,20 +2016,30 @@ class SecretsManagementSettings(_model_base.Model): :vartype key_exportable: bool """ - certificate_store_location: Optional[str] = rest_field(name="certificateStoreLocation") + certificate_store_location: Optional[str] = rest_field( + name="certificateStoreLocation", visibility=["read", "create", "update", "delete", "query"] + ) """Where to store certificates on the machine.""" - observed_certificates: List[str] = rest_field(name="observedCertificates") + certificate_store_name: Optional[Union[str, "_models.CertificateStoreNameOption"]] = rest_field( + name="certificateStoreName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the certificate store to use on the machine, currently 'My' and 'Root' are supported. + Known values are: \"My\" and \"Root\".""" + observed_certificates: list[str] = rest_field( + name="observedCertificates", visibility=["read", "create", "update", "delete", "query"] + ) """The list of certificates to install on all machines in the pool. Required.""" - key_exportable: bool = rest_field(name="keyExportable") + key_exportable: bool = rest_field(name="keyExportable", visibility=["read", "create", "update", "delete", "query"]) """Defines if the key of the certificates should be exportable. Required.""" @overload def __init__( self, *, - observed_certificates: List[str], + observed_certificates: list[str], key_exportable: bool, certificate_store_location: Optional[str] = None, + certificate_store_name: Optional[Union[str, "_models.CertificateStoreNameOption"]] = None, ) -> None: ... @overload @@ -1705,14 +2049,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class Stateful(AgentProfile, discriminator="Stateful"): """Stateful profile meaning that the machines will be returned to the pool after running a job. - :ivar resource_predictions: Defines pool buffer/stand-by agents. :vartype resource_predictions: ~azure.mgmt.devopsinfrastructure.models.ResourcePredictions :ivar resource_predictions_profile: Defines how the pool buffer/stand-by agents is provided. @@ -1729,12 +2072,16 @@ class Stateful(AgentProfile, discriminator="Stateful"): :vartype grace_period_time_span: str """ - kind: Literal["Stateful"] = rest_discriminator(name="kind") # type: ignore + kind: Literal["Stateful"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Stateful profile meaning that the machines will be returned to the pool after running a job. Required. Default value is \"Stateful\".""" - max_agent_lifetime: Optional[str] = rest_field(name="maxAgentLifetime") + max_agent_lifetime: Optional[str] = rest_field( + name="maxAgentLifetime", visibility=["read", "create", "update", "delete", "query"] + ) """How long should stateful machines be kept around. The maximum is one week.""" - grace_period_time_span: Optional[str] = rest_field(name="gracePeriodTimeSpan") + grace_period_time_span: Optional[str] = rest_field( + name="gracePeriodTimeSpan", visibility=["read", "create", "update", "delete", "query"] + ) """How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one week.""" @@ -1755,14 +2102,14 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind="Stateful", **kwargs) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = "Stateful" # type: ignore class StatelessAgentProfile(AgentProfile, discriminator="Stateless"): """Stateless profile meaning that the machines will be cleaned up after running a job. - :ivar resource_predictions: Defines pool buffer/stand-by agents. :vartype resource_predictions: ~azure.mgmt.devopsinfrastructure.models.ResourcePredictions :ivar resource_predictions_profile: Defines how the pool buffer/stand-by agents is provided. @@ -1773,7 +2120,7 @@ class StatelessAgentProfile(AgentProfile, discriminator="Stateless"): :vartype kind: str """ - kind: Literal["Stateless"] = rest_discriminator(name="kind") # type: ignore + kind: Literal["Stateless"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Stateless profile meaning that the machines will be cleaned up after running a job. Required. Default value is \"Stateless\".""" @@ -1792,11 +2139,12 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind="Stateless", **kwargs) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = "Stateless" # type: ignore -class StorageProfile(_model_base.Model): +class StorageProfile(_Model): """The storage profile of the VMSS. :ivar os_disk_storage_account_type: The Azure SKU name of the machines in the pool. Known @@ -1808,11 +2156,13 @@ class StorageProfile(_model_base.Model): """ os_disk_storage_account_type: Optional[Union[str, "_models.OsDiskStorageAccountType"]] = rest_field( - name="osDiskStorageAccountType" + name="osDiskStorageAccountType", visibility=["read", "create", "update", "delete", "query"] ) """The Azure SKU name of the machines in the pool. Known values are: \"Standard\", \"Premium\", and \"StandardSSD\".""" - data_disks: Optional[List["_models.DataDisk"]] = rest_field(name="dataDisks") + data_disks: Optional[list["_models.DataDisk"]] = rest_field( + name="dataDisks", visibility=["read", "create", "update", "delete", "query"] + ) """A list of empty data disks to attach.""" @overload @@ -1820,7 +2170,7 @@ def __init__( self, *, os_disk_storage_account_type: Optional[Union[str, "_models.OsDiskStorageAccountType"]] = None, - data_disks: Optional[List["_models.DataDisk"]] = None, + data_disks: Optional[list["_models.DataDisk"]] = None, ) -> None: ... @overload @@ -1830,11 +2180,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SystemData(_model_base.Model): +class SystemData(_Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. @@ -1853,19 +2203,29 @@ class SystemData(_model_base.Model): :vartype last_modified_at: ~datetime.datetime """ - created_by: Optional[str] = rest_field(name="createdBy") + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource creation (UTC).""" - last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that last modified the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource last modification (UTC).""" @overload @@ -1887,15 +2247,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class UserAssignedIdentity(_model_base.Model): +class UserAssignedIdentity(_Model): """User assigned identity properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of the assigned identity. :vartype principal_id: str :ivar client_id: The client ID of the assigned identity. @@ -1908,10 +2266,37 @@ class UserAssignedIdentity(_model_base.Model): """The client ID of the assigned identity.""" +class VmSize(_Model): + """Specifies the VM Size. + + :ivar name: Specifies the name of the VM Size. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the name of the VM Size.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class VmssFabricProfile(FabricProfile, discriminator="Vmss"): """The agents will run on Virtual Machine Scale Sets. - :ivar kind: Virtual Machine Scale Sets. Required. Default value is "Vmss". :vartype kind: str :ivar sku: The Azure SKU of the machines in the pool. Required. @@ -1926,17 +2311,23 @@ class VmssFabricProfile(FabricProfile, discriminator="Vmss"): :vartype network_profile: ~azure.mgmt.devopsinfrastructure.models.NetworkProfile """ - kind: Literal["Vmss"] = rest_discriminator(name="kind") # type: ignore + kind: Literal["Vmss"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """Virtual Machine Scale Sets. Required. Default value is \"Vmss\".""" - sku: "_models.DevOpsAzureSku" = rest_field() + sku: "_models.DevOpsAzureSku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The Azure SKU of the machines in the pool. Required.""" - images: List["_models.PoolImage"] = rest_field() + images: list["_models.PoolImage"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The VM images of the machines in the pool. Required.""" - os_profile: Optional["_models.OsProfile"] = rest_field(name="osProfile") + os_profile: Optional["_models.OsProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) """The OS profile of the machines in the pool.""" - storage_profile: Optional["_models.StorageProfile"] = rest_field(name="storageProfile") + storage_profile: Optional["_models.StorageProfile"] = rest_field( + name="storageProfile", visibility=["read", "create", "update", "delete", "query"] + ) """The storage profile of the machines in the pool.""" - network_profile: Optional["_models.NetworkProfile"] = rest_field(name="networkProfile") + network_profile: Optional["_models.NetworkProfile"] = rest_field( + name="networkProfile", visibility=["read", "create", "update", "delete", "query"] + ) """The network profile of the machines in the pool.""" @overload @@ -1944,7 +2335,7 @@ def __init__( self, *, sku: "_models.DevOpsAzureSku", - images: List["_models.PoolImage"], + images: list["_models.PoolImage"], os_profile: Optional["_models.OsProfile"] = None, storage_profile: Optional["_models.StorageProfile"] = None, network_profile: Optional["_models.NetworkProfile"] = None, @@ -1957,5 +2348,6 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, kind="Vmss", **kwargs) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.kind = "Vmss" # type: ignore diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py index a187f0c9bdbc..025faf189e43 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py @@ -5,16 +5,22 @@ # 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 ._operations import Operations -from ._operations import PoolsOperations -from ._operations import ResourceDetailsOperations -from ._operations import SkuOperations -from ._operations import SubscriptionUsagesOperations -from ._operations import ImageVersionsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import PoolsOperations # type: ignore +from ._operations import ResourceDetailsOperations # type: ignore +from ._operations import SkuOperations # type: ignore +from ._operations import SubscriptionUsagesOperations # type: ignore +from ._operations import ImageVersionsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py index 76e8943e965f..08687eef2c33 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,17 +32,15 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer +from .. import models as _models, types as _types +from .._configuration import DevOpsInfrastructureMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer +from .._validation import api_version_validation -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -51,7 +50,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,11 +71,11 @@ def build_pools_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -101,11 +100,11 @@ def build_pools_create_or_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -132,11 +131,11 @@ def build_pools_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -159,14 +158,11 @@ def build_pools_update_request( def build_pools_delete_request( resource_group_name: str, pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -178,10 +174,7 @@ def build_pools_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_pools_list_by_resource_group_request( # pylint: disable=name-too-long @@ -190,11 +183,11 @@ def build_pools_list_by_resource_group_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -215,7 +208,7 @@ def build_pools_list_by_subscription_request(subscription_id: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,17 +228,74 @@ def build_pools_list_by_subscription_request(subscription_id: str, **kwargs: Any return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_pools_check_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pools_delete_resources_request( + resource_group_name: str, pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}/resources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_resource_details_list_by_pool_request( # pylint: disable=name-too-long resource_group_name: str, pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}/resources" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}/resources" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -267,7 +317,7 @@ def build_sku_list_by_location_request(location_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,7 +342,7 @@ def build_subscription_usages_usages_request(location: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,11 +369,11 @@ def build_image_versions_list_by_image_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-19")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-03-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/images/{imageName}/versions" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/images/{imageName}/versions" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -351,25 +401,27 @@ class Operations: :attr:`operations` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models._models.Operation"]: + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: """List the operations for the provider. :return: An iterator like instance of Operation - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devopsinfrastructure.models._models.Operation] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devopsinfrastructure.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models._models.Operation]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -405,7 +457,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -418,7 +473,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models._models.Operation], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -434,7 +492,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -452,12 +513,14 @@ class PoolsOperations: :attr:`pools` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: @@ -498,6 +561,7 @@ def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _model } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -512,11 +576,14 @@ def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _model except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.Pool, response.json()) @@ -526,7 +593,11 @@ def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _model return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + pool_name: str, + resource: Union[_models.Pool, _types.Pool, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -564,6 +635,7 @@ def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -577,14 +649,17 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -623,7 +698,7 @@ def begin_create_or_update( self, resource_group_name: str, pool_name: str, - resource: JSON, + resource: _types.Pool, *, content_type: str = "application/json", **kwargs: Any @@ -636,7 +711,7 @@ def begin_create_or_update( :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.devopsinfrastructure.types.Pool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -674,7 +749,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, JSON, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + pool_name: str, + resource: Union[_models.Pool, _types.Pool, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.Pool]: """Create a Pool. @@ -683,9 +762,10 @@ def begin_create_or_update( :type resource_group_name: str :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str - :param resource: Resource create parameters. Is one of the following types: Pool, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a Pool type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool or + ~azure.mgmt.devopsinfrastructure.types.Pool or IO[bytes] :return: An instance of LROPoller that returns Pool. The Pool is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] :raises ~azure.core.exceptions.HttpResponseError: @@ -746,7 +826,7 @@ def _update_initial( self, resource_group_name: str, pool_name: str, - properties: Union[_models.PoolUpdate, JSON, IO[bytes]], + properties: Union[_models.PoolUpdate, _types.PoolUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -785,6 +865,7 @@ def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -798,7 +879,10 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -806,7 +890,7 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -845,7 +929,7 @@ def begin_update( self, resource_group_name: str, pool_name: str, - properties: JSON, + properties: _types.PoolUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -858,7 +942,7 @@ def begin_update( :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.devopsinfrastructure.types.PoolUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -899,7 +983,7 @@ def begin_update( self, resource_group_name: str, pool_name: str, - properties: Union[_models.PoolUpdate, JSON, IO[bytes]], + properties: Union[_models.PoolUpdate, _types.PoolUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Pool]: """Update a Pool. @@ -909,9 +993,10 @@ def begin_update( :type resource_group_name: str :param pool_name: Name of the pool. It needs to be globally unique. Required. :type pool_name: str - :param properties: The resource properties to be updated. Is one of the following types: - PoolUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a PoolUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate or + ~azure.mgmt.devopsinfrastructure.types.PoolUpdate or IO[bytes] :return: An instance of LROPoller that returns Pool. The Pool is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] :raises ~azure.core.exceptions.HttpResponseError: @@ -995,6 +1080,7 @@ def _delete_initial(self, resource_group_name: str, pool_name: str, **kwargs: An } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1008,7 +1094,10 @@ def _delete_initial(self, resource_group_name: str, pool_name: str, **kwargs: An except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1016,7 +1105,7 @@ def _delete_initial(self, resource_group_name: str, pool_name: str, **kwargs: An response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1081,7 +1170,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pool"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Pool"]: """List Pool resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1132,7 +1221,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1145,7 +1237,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pool], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Pool], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1161,7 +1256,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1169,7 +1267,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Pool"]: + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.Pool"]: """List Pool resources by subscription ID. :return: An iterator like instance of Pool @@ -1216,7 +1314,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1229,7 +1330,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pool], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Pool], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1245,13 +1349,312 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + @overload + def check_name_availability( + self, body: _models.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, body: _types.CheckNameAvailability, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.types.CheckNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, body: Union[_models.CheckNameAvailability, _types.CheckNameAvailability, IO[bytes]], **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the pool name is valid and is not already in use. + + :param body: The CheckAvailability request. Is either a CheckNameAvailability type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailability or + ~azure.mgmt.devopsinfrastructure.types.CheckNameAvailability or IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.devopsinfrastructure.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pools_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: _models.DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.DeleteResourcesDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: _types.DeleteResourcesDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.devopsinfrastructure.types.DeleteResourcesDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def delete_resources( + self, + resource_group_name: str, + pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2025-09-20", + params_added_on={ + "2025-09-20": ["api_version", "subscription_id", "resource_group_name", "pool_name", "content_type"] + }, + api_versions_list=["2025-09-20", "2026-04-17-preview", "2026-06-02", "2026-07-03-preview"], + ) + def delete_resources( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + pool_name: str, + body: Union[_models.DeleteResourcesDetails, _types.DeleteResourcesDetails, IO[bytes]], + **kwargs: Any + ) -> None: + """A synchronous resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param body: The content of the action request. Is either a DeleteResourcesDetails type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.devopsinfrastructure.models.DeleteResourcesDetails or + ~azure.mgmt.devopsinfrastructure.types.DeleteResourcesDetails or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pools_delete_resources_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + class ResourceDetailsOperations: """ @@ -1263,17 +1666,19 @@ class ResourceDetailsOperations: :attr:`resource_details` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_pool( self, resource_group_name: str, pool_name: str, **kwargs: Any - ) -> Iterable["_models.ResourceDetailsObject"]: + ) -> ItemPaged["_models.ResourceDetailsObject"]: """List ResourceDetailsObject resources by Pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1328,7 +1733,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1341,7 +1749,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ResourceDetailsObject], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.ResourceDetailsObject], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1357,7 +1768,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1375,15 +1789,17 @@ class SkuOperations: :attr:`sku` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_location(self, location_name: str, **kwargs: Any) -> Iterable["_models.ResourceSku"]: + def list_by_location(self, location_name: str, **kwargs: Any) -> ItemPaged["_models.ResourceSku"]: """List ResourceSku resources by subscription ID. :param location_name: Name of the location. Required. @@ -1433,7 +1849,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1446,7 +1865,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ResourceSku], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.ResourceSku], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1462,7 +1884,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1480,15 +1905,17 @@ class SubscriptionUsagesOperations: :attr:`subscription_usages` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def usages(self, location: str, **kwargs: Any) -> Iterable["_models.Quota"]: + def usages(self, location: str, **kwargs: Any) -> ItemPaged["_models.Quota"]: """List Quota resources by subscription ID. :param location: The name of the Azure region. Required. @@ -1538,7 +1965,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1551,7 +1981,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Quota], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.Quota], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1567,7 +2000,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1585,17 +2021,19 @@ class ImageVersionsOperations: :attr:`image_versions` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DevOpsInfrastructureMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_image( self, resource_group_name: str, image_name: str, **kwargs: Any - ) -> Iterable["_models.ImageVersion"]: + ) -> ItemPaged["_models.ImageVersion"]: """List ImageVersion resources by Image. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1649,7 +2087,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1662,7 +2103,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ImageVersion], deserialized["value"]) + list_of_elem = _deserialize( + List[_models.ImageVersion], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1678,7 +2122,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/types.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/types.py new file mode 100644 index 000000000000..de0dd606503a --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/types.py @@ -0,0 +1,782 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 typing import Literal, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +from .models._enums import ResourcePredictionsProfileType + +if TYPE_CHECKING: + from .models import ( + AzureDevOpsPermissionType, + CachingType, + CertificateStoreNameOption, + CreatedByType, + DevOpsInfrastructureResourceType, + EphemeralType, + LogonType, + ManagedServiceIdentityType, + OsDiskStorageAccountType, + PredictionPreference, + ProvisioningState, + StorageAccountType, + ) + + +class AutomaticResourcePredictionsProfile(TypedDict, total=False): + """The stand-by agent scheme is determined based on historical demand. + + :ivar kind: The stand-by agent scheme is determined based on historical demand. Required. The + stand-by agent scheme is determined based on historical demand. + :vartype kind: Literal[ResourcePredictionsProfileType.AUTOMATIC] + :ivar prediction_preference: Determines the balance between cost and performance. Known values + are: "Balanced", "MostCostEffective", "MoreCostEffective", "MorePerformance", and + "BestPerformance". + :vartype prediction_preference: Union[str, "PredictionPreference"] + """ + + kind: Required[Literal[ResourcePredictionsProfileType.AUTOMATIC]] + """The stand-by agent scheme is determined based on historical demand. Required. The stand-by + agent scheme is determined based on historical demand.""" + predictionPreference: Union[str, "PredictionPreference"] + """Determines the balance between cost and performance. Known values are: \"Balanced\", + \"MostCostEffective\", \"MoreCostEffective\", \"MorePerformance\", and \"BestPerformance\".""" + + +class AzureDevOpsOrganizationProfile(TypedDict, total=False): + """Azure DevOps organization profile. + + :ivar kind: Azure DevOps organization profile. Required. Default value is "AzureDevOps". + :vartype kind: Literal["AzureDevOps"] + :ivar description: An extra description to add to the Azure DevOps pool. + :vartype description: str + :ivar update_description: Determines whether the service updates the Azure DevOps pool + description. + :vartype update_description: bool + :ivar organizations: The list of Azure DevOps organizations the pool should be present in. + Required. + :vartype organizations: list["Organization"] + :ivar permission_profile: The type of permission which determines which accounts are admins on + the Azure DevOps pool. + :vartype permission_profile: "AzureDevOpsPermissionProfile" + :ivar alias: An alias to reference the Azure DevOps pool name. + :vartype alias: str + """ + + kind: Required[Literal["AzureDevOps"]] + """Azure DevOps organization profile. Required. Default value is \"AzureDevOps\".""" + description: str + """An extra description to add to the Azure DevOps pool.""" + updateDescription: bool + """Determines whether the service updates the Azure DevOps pool description.""" + organizations: Required[list["Organization"]] + """The list of Azure DevOps organizations the pool should be present in. Required.""" + permissionProfile: "AzureDevOpsPermissionProfile" + """The type of permission which determines which accounts are admins on the Azure DevOps pool.""" + alias: str + """An alias to reference the Azure DevOps pool name.""" + + +class AzureDevOpsPermissionProfile(TypedDict, total=False): + """Defines the type of Azure DevOps pool permission. + + :ivar kind: Determines who has admin permissions to the Azure DevOps pool. Required. Known + values are: "Inherit", "CreatorOnly", and "SpecificAccounts". + :vartype kind: Union[str, "AzureDevOpsPermissionType"] + :ivar users: User email addresses. + :vartype users: list[str] + :ivar groups: Group email addresses. + :vartype groups: list[str] + """ + + kind: Required[Union[str, "AzureDevOpsPermissionType"]] + """Determines who has admin permissions to the Azure DevOps pool. Required. Known values are: + \"Inherit\", \"CreatorOnly\", and \"SpecificAccounts\".""" + users: list[str] + """User email addresses.""" + groups: list[str] + """Group email addresses.""" + + +class CheckNameAvailability(TypedDict, total=False): + """The parameters used to check the availability of a resource. + + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar type: The type of resource that is used as the scope of the availability check. Required. + "Microsoft.DevOpsInfrastructure/pools" + :vartype type: Union[str, "DevOpsInfrastructureResourceType"] + """ + + name: Required[str] + """The name of the resource. Required.""" + type: Required[Union[str, "DevOpsInfrastructureResourceType"]] + """The type of resource that is used as the scope of the availability check. Required. + \"Microsoft.DevOpsInfrastructure/pools\"""" + + +class DataDisk(TypedDict, total=False): + """The data disk of the VMSS. + + :ivar caching: The type of caching to be enabled for the data disks. The default value for + caching is readwrite. For information about the caching options see: + `https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/ + `_. + Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype caching: Union[str, "CachingType"] + :ivar disk_size_gi_b: The initial disk size in gigabytes. + :vartype disk_size_gi_b: int + :ivar storage_account_type: The storage Account type to be used for the data disk. If omitted, + the default is "standard_lrs". Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "Premium_ZRS", and "StandardSSD_ZRS". + :vartype storage_account_type: Union[str, "StorageAccountType"] + :ivar drive_letter: The drive letter for the empty data disk. If not specified, it will be the + first available letter. + :vartype drive_letter: str + """ + + caching: Union[str, "CachingType"] + """The type of caching to be enabled for the data disks. The default value for caching is + readwrite. For information about the caching options see: + `https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/ + `_. + Known values are: \"None\", \"ReadOnly\", and \"ReadWrite\".""" + diskSizeGiB: int + """The initial disk size in gigabytes.""" + storageAccountType: Union[str, "StorageAccountType"] + """The storage Account type to be used for the data disk. If omitted, the default is + \"standard_lrs\". Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"Premium_ZRS\", and \"StandardSSD_ZRS\".""" + driveLetter: str + """The drive letter for the empty data disk. If not specified, it will be the first available + letter.""" + + +class DeleteResourcesDetails(TypedDict, total=False): + """Request body for deleting many resources by their IDs. + + :ivar resource_ids: List of resource IDs to delete. Required. + :vartype resource_ids: list[str] + """ + + resourceIds: Required[list[str]] + """List of resource IDs to delete. Required.""" + + +class DevOpsAzureSku(TypedDict, total=False): + """The Azure SKU of the machines in the pool. + + :ivar name: The Azure SKU name of the machines in the pool. Required. + :vartype name: str + :ivar windows_nvme_drive: The drive letter for the NVMe striped volume on Windows (e.g., 'N'). + Defaults to 'N' when not specified. + :vartype windows_nvme_drive: str + :ivar linux_nvme_path: The mount path for the NVMe striped volume on Linux (e.g., + '/mnt/azure_nvme_temp'). Defaults to '/mnt/azure_nvme_temp' when not specified. + :vartype linux_nvme_path: str + :ivar vm_sizes: Specifies VM sizes for instance-mix allocation. + :vartype vm_sizes: list["VmSize"] + """ + + name: Required[str] + """The Azure SKU name of the machines in the pool. Required.""" + windowsNvmeDrive: str + """The drive letter for the NVMe striped volume on Windows (e.g., 'N'). Defaults to 'N' when not + specified.""" + linuxNvmePath: str + """The mount path for the NVMe striped volume on Linux (e.g., '/mnt/azure_nvme_temp'). Defaults to + '/mnt/azure_nvme_temp' when not specified.""" + vmSizes: list["VmSize"] + """Specifies VM sizes for instance-mix allocation.""" + + +class GitHubOrganization(TypedDict, total=False): + """Defines a GitHub organization. + + :ivar url: The GitHub organization URL in which the pool should be created. Required. + :vartype url: str + :ivar repositories: Optional list of repositories in which the pool should be created. + :vartype repositories: list[str] + """ + + url: Required[str] + """The GitHub organization URL in which the pool should be created. Required.""" + repositories: list[str] + """Optional list of repositories in which the pool should be created.""" + + +class GitHubOrganizationProfile(TypedDict, total=False): + """GitHub organization profile. + + :ivar kind: GitHub organization profile. Required. Default value is "GitHub". + :vartype kind: Literal["GitHub"] + :ivar organizations: The list of GitHub organizations/repositories the pool should be present + in. Required. + :vartype organizations: list["GitHubOrganization"] + """ + + kind: Required[Literal["GitHub"]] + """GitHub organization profile. Required. Default value is \"GitHub\".""" + organizations: Required[list["GitHubOrganization"]] + """The list of GitHub organizations/repositories the pool should be present in. Required.""" + + +class Resource(TypedDict, total=False): + """Resource. + + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + """ + + id: str + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: str + """The name of the resource.""" + type: str + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + systemData: "SystemData" + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ManagedServiceIdentity(TypedDict, total=False): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: Union[str, "ManagedServiceIdentityType"] + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, "UserAssignedIdentity"] + """ + + principalId: str + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenantId: str + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Required[Union[str, "ManagedServiceIdentityType"]] + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + userAssignedIdentities: dict[str, "UserAssignedIdentity"] + """The identities assigned to this resource by the user.""" + + +class ManualResourcePredictionsProfile(TypedDict, total=False): + """Customer provides the stand-by agent scheme. + + :ivar kind: Customer provides the stand-by agent scheme. Required. Customer provides the + stand-by agent scheme. + :vartype kind: Literal[ResourcePredictionsProfileType.MANUAL] + """ + + kind: Required[Literal[ResourcePredictionsProfileType.MANUAL]] + """Customer provides the stand-by agent scheme. Required. Customer provides the stand-by agent + scheme.""" + + +class NetworkProfile(TypedDict, total=False): + """The network profile of the machines in the pool. + + :ivar subnet_id: The subnet id on which to put all machines created in the pool. + :vartype subnet_id: str + :ivar static_ip_address_count: The number of static public IP addresses for outgoing + connections assigned to the pool. + :vartype static_ip_address_count: int + :ivar ip_addresses: Read only. The list of static public IP addresses for outgoing connections + assigned to the pool. + :vartype ip_addresses: list[str] + """ + + subnetId: str + """The subnet id on which to put all machines created in the pool.""" + staticIpAddressCount: int + """The number of static public IP addresses for outgoing connections assigned to the pool.""" + ipAddresses: list[str] + """Read only. The list of static public IP addresses for outgoing connections assigned to the + pool.""" + + +class Organization(TypedDict, total=False): + """Defines an Azure DevOps organization. + + :ivar url: The Azure DevOps organization URL in which the pool should be created. Required. + :vartype url: str + :ivar projects: Optional list of projects in which the pool should be created. + :vartype projects: list[str] + :ivar parallelism: How many machines can be created at maximum in this organization out of the + maximumConcurrency of the pool. + :vartype parallelism: int + :ivar open_access: Determines if the pool should have open access to all projects in this + organization. + :vartype open_access: bool + :ivar alias: An alias to reference the Azure DevOps pool name. + :vartype alias: str + """ + + url: Required[str] + """The Azure DevOps organization URL in which the pool should be created. Required.""" + projects: list[str] + """Optional list of projects in which the pool should be created.""" + parallelism: int + """How many machines can be created at maximum in this organization out of the maximumConcurrency + of the pool.""" + openAccess: bool + """Determines if the pool should have open access to all projects in this organization.""" + alias: str + """An alias to reference the Azure DevOps pool name.""" + + +class OsProfile(TypedDict, total=False): + """The OS profile of the machines in the pool. + + :ivar secrets_management_settings: The secret management settings of the machines in the pool. + :vartype secrets_management_settings: "SecretsManagementSettings" + :ivar logon_type: Determines how the service should be run. By default, this will be set to + Service. Known values are: "Service" and "Interactive". + :vartype logon_type: Union[str, "LogonType"] + """ + + secretsManagementSettings: "SecretsManagementSettings" + """The secret management settings of the machines in the pool.""" + logonType: Union[str, "LogonType"] + """Determines how the service should be run. By default, this will be set to Service. Known values + are: \"Service\" and \"Interactive\".""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: dict[str, str] + """Resource tags.""" + location: Required[str] + """The geo-location where the resource lives. Required.""" + + +class Pool(TrackedResource): + """Concrete tracked resource types can be created by aliasing this type using a specific property + type. + + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "PoolProperties" + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: "ManagedServiceIdentity" + """ + + properties: "PoolProperties" + """The resource-specific properties for this resource.""" + identity: "ManagedServiceIdentity" + """The managed service identities assigned to this resource.""" + + +class PoolImage(TypedDict, total=False): + """The VM image of the machines in the pool. + + :ivar resource_id: The resource id of the image. + :vartype resource_id: str + :ivar well_known_image_name: The image to use from a well-known set of images made available to + customers. + :vartype well_known_image_name: str + :ivar aliases: List of aliases to reference the image by. + :vartype aliases: list[str] + :ivar buffer: The percentage of the buffer to be allocated to this image. + :vartype buffer: str + :ivar ephemeral_type: The ephemeral type of the image. Known values are: "Automatic", + "CacheDisk", "ResourceDisk", and "NVMeDisk". + :vartype ephemeral_type: Union[str, "EphemeralType"] + :ivar is_ephemeral: Read only. Determines if the image is ephemeral. + :vartype is_ephemeral: bool + :ivar provisioning_script_storage_account_resource_id: The ARM resource ID of the storage + account hosting provisioning scripts for this image. + :vartype provisioning_script_storage_account_resource_id: str + :ivar provisioning_script_managed_identity_client_id: The managed identity client ID used to + access provisioning script content for this image. + :vartype provisioning_script_managed_identity_client_id: str + :ivar provisioning_script_should_restart: Determines whether the machine should be restarted + after provisioning script execution for this image. + :vartype provisioning_script_should_restart: bool + :ivar provisioning_script_entry_point: The provisioning script entry point for this image. + :vartype provisioning_script_entry_point: str + """ + + resourceId: str + """The resource id of the image.""" + wellKnownImageName: str + """The image to use from a well-known set of images made available to customers.""" + aliases: list[str] + """List of aliases to reference the image by.""" + buffer: str + """The percentage of the buffer to be allocated to this image.""" + ephemeralType: Union[str, "EphemeralType"] + """The ephemeral type of the image. Known values are: \"Automatic\", \"CacheDisk\", + \"ResourceDisk\", and \"NVMeDisk\".""" + isEphemeral: bool + """Read only. Determines if the image is ephemeral.""" + provisioningScriptStorageAccountResourceId: str + """The ARM resource ID of the storage account hosting provisioning scripts for this image.""" + provisioningScriptManagedIdentityClientId: str + """The managed identity client ID used to access provisioning script content for this image.""" + provisioningScriptShouldRestart: bool + """Determines whether the machine should be restarted after provisioning script execution for this + image.""" + provisioningScriptEntryPoint: str + """The provisioning script entry point for this image.""" + + +class PoolProperties(TypedDict, total=False): + """Pool properties. + + :ivar provisioning_state: The status of the current operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: Union[str, "ProvisioningState"] + :ivar maximum_concurrency: Defines how many resources can there be created at any given time. + Required. + :vartype maximum_concurrency: int + :ivar organization_profile: Defines the organization in which the pool will be used. Required. + :vartype organization_profile: "OrganizationProfile" + :ivar agent_profile: Defines how the machine will be handled once it executed a job. Required. + :vartype agent_profile: "AgentProfile" + :ivar fabric_profile: Defines the type of fabric the agent will run on. Required. + :vartype fabric_profile: "FabricProfile" + :ivar dev_center_project_resource_id: The resource id of the DevCenter Project the pool belongs + to. + :vartype dev_center_project_resource_id: str + :ivar runtime_configuration: The runtime configuration of the pool. + :vartype runtime_configuration: "RuntimeConfiguration" + """ + + provisioningState: Union[str, "ProvisioningState"] + """The status of the current operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" + maximumConcurrency: Required[int] + """Defines how many resources can there be created at any given time. Required.""" + organizationProfile: Required["OrganizationProfile"] + """Defines the organization in which the pool will be used. Required.""" + agentProfile: Required["AgentProfile"] + """Defines how the machine will be handled once it executed a job. Required.""" + fabricProfile: Required["FabricProfile"] + """Defines the type of fabric the agent will run on. Required.""" + devCenterProjectResourceId: str + """The resource id of the DevCenter Project the pool belongs to.""" + runtimeConfiguration: "RuntimeConfiguration" + """The runtime configuration of the pool.""" + + +class PoolUpdate(TypedDict, total=False): + """The type used for update operations of the Pool. + + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: "ManagedServiceIdentity" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "PoolUpdateProperties" + """ + + identity: "ManagedServiceIdentity" + """The managed service identities assigned to this resource.""" + tags: dict[str, str] + """Resource tags.""" + properties: "PoolUpdateProperties" + """The resource-specific properties for this resource.""" + + +class PoolUpdateProperties(TypedDict, total=False): + """The updatable properties of the Pool. + + :ivar provisioning_state: The status of the current operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: Union[str, "ProvisioningState"] + :ivar maximum_concurrency: Defines how many resources can there be created at any given time. + :vartype maximum_concurrency: int + :ivar organization_profile: Defines the organization in which the pool will be used. + :vartype organization_profile: "OrganizationProfile" + :ivar agent_profile: Defines how the machine will be handled once it executed a job. + :vartype agent_profile: "AgentProfile" + :ivar fabric_profile: Defines the type of fabric the agent will run on. + :vartype fabric_profile: "FabricProfile" + :ivar dev_center_project_resource_id: The resource id of the DevCenter Project the pool belongs + to. + :vartype dev_center_project_resource_id: str + :ivar runtime_configuration: The runtime configuration of the pool. + :vartype runtime_configuration: "RuntimeConfiguration" + """ + + provisioningState: Union[str, "ProvisioningState"] + """The status of the current operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" + maximumConcurrency: int + """Defines how many resources can there be created at any given time.""" + organizationProfile: "OrganizationProfile" + """Defines the organization in which the pool will be used.""" + agentProfile: "AgentProfile" + """Defines how the machine will be handled once it executed a job.""" + fabricProfile: "FabricProfile" + """Defines the type of fabric the agent will run on.""" + devCenterProjectResourceId: str + """The resource id of the DevCenter Project the pool belongs to.""" + runtimeConfiguration: "RuntimeConfiguration" + """The runtime configuration of the pool.""" + + +class ResourcePredictions(TypedDict, total=False): + """Defines pool buffer.""" + + +class RuntimeConfiguration(TypedDict, total=False): + """The runtime configuration of the pool. + + :ivar work_folder: The target work folder of the task agent on the machine. + :vartype work_folder: str + """ + + workFolder: str + """The target work folder of the task agent on the machine.""" + + +class SecretsManagementSettings(TypedDict, total=False): + """The secret management settings of the machines in the pool. + + :ivar certificate_store_location: Where to store certificates on the machine. + :vartype certificate_store_location: str + :ivar certificate_store_name: Name of the certificate store to use on the machine, currently + 'My' and 'Root' are supported. Known values are: "My" and "Root". + :vartype certificate_store_name: Union[str, "CertificateStoreNameOption"] + :ivar observed_certificates: The list of certificates to install on all machines in the pool. + Required. + :vartype observed_certificates: list[str] + :ivar key_exportable: Defines if the key of the certificates should be exportable. Required. + :vartype key_exportable: bool + """ + + certificateStoreLocation: str + """Where to store certificates on the machine.""" + certificateStoreName: Union[str, "CertificateStoreNameOption"] + """Name of the certificate store to use on the machine, currently 'My' and 'Root' are supported. + Known values are: \"My\" and \"Root\".""" + observedCertificates: Required[list[str]] + """The list of certificates to install on all machines in the pool. Required.""" + keyExportable: Required[bool] + """Defines if the key of the certificates should be exportable. Required.""" + + +class Stateful(TypedDict, total=False): + """Stateful profile meaning that the machines will be returned to the pool after running a job. + + :ivar resource_predictions: Defines pool buffer/stand-by agents. + :vartype resource_predictions: "ResourcePredictions" + :ivar resource_predictions_profile: Defines how the pool buffer/stand-by agents is provided. + :vartype resource_predictions_profile: "ResourcePredictionsProfile" + :ivar kind: Stateful profile meaning that the machines will be returned to the pool after + running a job. Required. Default value is "Stateful". + :vartype kind: Literal["Stateful"] + :ivar max_agent_lifetime: How long should stateful machines be kept around. The maximum is one + week. + :vartype max_agent_lifetime: str + :ivar grace_period_time_span: How long should the machine be kept around after it ran a + workload when there are no stand-by agents. The maximum is one week. + :vartype grace_period_time_span: str + """ + + resourcePredictions: "ResourcePredictions" + """Defines pool buffer/stand-by agents.""" + resourcePredictionsProfile: "ResourcePredictionsProfile" + """Defines how the pool buffer/stand-by agents is provided.""" + kind: Required[Literal["Stateful"]] + """Stateful profile meaning that the machines will be returned to the pool after running a job. + Required. Default value is \"Stateful\".""" + maxAgentLifetime: str + """How long should stateful machines be kept around. The maximum is one week.""" + gracePeriodTimeSpan: str + """How long should the machine be kept around after it ran a workload when there are no stand-by + agents. The maximum is one week.""" + + +class StatelessAgentProfile(TypedDict, total=False): + """Stateless profile meaning that the machines will be cleaned up after running a job. + + :ivar resource_predictions: Defines pool buffer/stand-by agents. + :vartype resource_predictions: "ResourcePredictions" + :ivar resource_predictions_profile: Defines how the pool buffer/stand-by agents is provided. + :vartype resource_predictions_profile: "ResourcePredictionsProfile" + :ivar kind: Stateless profile meaning that the machines will be cleaned up after running a job. + Required. Default value is "Stateless". + :vartype kind: Literal["Stateless"] + """ + + resourcePredictions: "ResourcePredictions" + """Defines pool buffer/stand-by agents.""" + resourcePredictionsProfile: "ResourcePredictionsProfile" + """Defines how the pool buffer/stand-by agents is provided.""" + kind: Required[Literal["Stateless"]] + """Stateless profile meaning that the machines will be cleaned up after running a job. Required. + Default value is \"Stateless\".""" + + +class StorageProfile(TypedDict, total=False): + """The storage profile of the VMSS. + + :ivar os_disk_storage_account_type: The Azure SKU name of the machines in the pool. Known + values are: "Standard", "Premium", and "StandardSSD". + :vartype os_disk_storage_account_type: Union[str, "OsDiskStorageAccountType"] + :ivar data_disks: A list of empty data disks to attach. + :vartype data_disks: list["DataDisk"] + """ + + osDiskStorageAccountType: Union[str, "OsDiskStorageAccountType"] + """The Azure SKU name of the machines in the pool. Known values are: \"Standard\", \"Premium\", + and \"StandardSSD\".""" + dataDisks: list["DataDisk"] + """A list of empty data disks to attach.""" + + +class SystemData(TypedDict, total=False): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: Union[str, "CreatedByType"] + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: str + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: Union[str, "CreatedByType"] + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: str + """ + + createdBy: str + """The identity that created the resource.""" + createdByType: Union[str, "CreatedByType"] + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + createdAt: str + """The timestamp of resource creation (UTC).""" + lastModifiedBy: str + """The identity that last modified the resource.""" + lastModifiedByType: Union[str, "CreatedByType"] + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + lastModifiedAt: str + """The timestamp of resource last modification (UTC).""" + + +class UserAssignedIdentity(TypedDict, total=False): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principalId: str + """The principal ID of the assigned identity.""" + clientId: str + """The client ID of the assigned identity.""" + + +class VmSize(TypedDict, total=False): + """Specifies the VM Size. + + :ivar name: Specifies the name of the VM Size. + :vartype name: str + """ + + name: str + """Specifies the name of the VM Size.""" + + +class VmssFabricProfile(TypedDict, total=False): + """The agents will run on Virtual Machine Scale Sets. + + :ivar kind: Virtual Machine Scale Sets. Required. Default value is "Vmss". + :vartype kind: Literal["Vmss"] + :ivar sku: The Azure SKU of the machines in the pool. Required. + :vartype sku: "DevOpsAzureSku" + :ivar images: The VM images of the machines in the pool. Required. + :vartype images: list["PoolImage"] + :ivar os_profile: The OS profile of the machines in the pool. + :vartype os_profile: "OsProfile" + :ivar storage_profile: The storage profile of the machines in the pool. + :vartype storage_profile: "StorageProfile" + :ivar network_profile: The network profile of the machines in the pool. + :vartype network_profile: "NetworkProfile" + """ + + kind: Required[Literal["Vmss"]] + """Virtual Machine Scale Sets. Required. Default value is \"Vmss\".""" + sku: Required["DevOpsAzureSku"] + """The Azure SKU of the machines in the pool. Required.""" + images: Required[list["PoolImage"]] + """The VM images of the machines in the pool. Required.""" + osProfile: "OsProfile" + """The OS profile of the machines in the pool.""" + storageProfile: "StorageProfile" + """The storage profile of the machines in the pool.""" + networkProfile: "NetworkProfile" + """The network profile of the machines in the pool.""" + + +AgentProfile = Union[Stateful, StatelessAgentProfile] +ResourcePredictionsProfile = Union[AutomaticResourcePredictionsProfile, ManualResourcePredictionsProfile] +OrganizationProfile = Union[AzureDevOpsOrganizationProfile, GitHubOrganizationProfile] +FabricProfile = Union[VmssFabricProfile] diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py index d896c6b32b09..7e293560286c 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,14 +40,36 @@ def main(): "agentProfile": {"kind": "Stateless"}, "devCenterProjectResourceId": "/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES", "fabricProfile": { - "images": [{"resourceId": "/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"}], + "images": [ + { + "ephemeralType": "NVMeDisk", + "provisioningScriptEntryPoint": "scripts/setup-agent.ps1", + "provisioningScriptManagedIdentityClientId": "0f8fad5b-d9cb-469f-a165-70867728950e", + "provisioningScriptShouldRestart": True, + "provisioningScriptStorageAccountResourceId": "/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/provisioningscriptsa", + "resourceId": "/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest", + } + ], "kind": "Vmss", + "networkProfile": { + "staticIpAddressCount": 2, + "subnetId": "/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet", + }, + "osProfile": { + "secretsManagementSettings": { + "certificateStoreName": "Root", + "keyExportable": False, + "observedCertificates": ["https://abc.vault.azure.net/secrets/one"], + } + }, "sku": {"name": "Standard_D4ads_v5"}, }, "maximumConcurrency": 10, "organizationProfile": { + "description": "Managed by Managed DevOps Pools", "kind": "AzureDevOps", - "organizations": [{"url": "https://mseng.visualstudio.com"}], + "organizations": [{"openAccess": True, "url": "https://mseng.visualstudio.com"}], + "updateDescription": True, }, "provisioningState": "Succeeded", }, @@ -55,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: 2024-10-19/CreateOrUpdatePool.json +# x-ms-original-file: 2026-07-03-preview/CreateOrUpdatePool.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool_instance_mix.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool_instance_mix.py new file mode 100644 index 000000000000..7ea4fdd8b30f --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool_instance_mix.py @@ -0,0 +1,83 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.devopsinfrastructure import DevOpsInfrastructureMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python create_or_update_pool_instance_mix.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevOpsInfrastructureMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pools.begin_create_or_update( + resource_group_name="rg", + pool_name="pool", + resource={ + "location": "eastus", + "properties": { + "agentProfile": {"kind": "Stateless"}, + "devCenterProjectResourceId": "/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES", + "fabricProfile": { + "images": [ + { + "ephemeralType": "Automatic", + "provisioningScriptEntryPoint": "scripts/setup-agent.ps1", + "provisioningScriptManagedIdentityClientId": "0f8fad5b-d9cb-469f-a165-70867728950e", + "provisioningScriptShouldRestart": True, + "provisioningScriptStorageAccountResourceId": "/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/provisioningscriptsa", + "resourceId": "/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest", + } + ], + "kind": "Vmss", + "networkProfile": { + "staticIpAddressCount": 2, + "subnetId": "/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet", + }, + "osProfile": { + "secretsManagementSettings": { + "certificateStoreName": "Root", + "keyExportable": False, + "observedCertificates": ["https://abc.vault.azure.net/secrets/one"], + } + }, + "sku": {"name": "Mix", "vmSizes": [{"name": "Standard_E2ads_v5"}, {"name": "Standard_D2ads_v5"}]}, + }, + "maximumConcurrency": 10, + "organizationProfile": { + "description": "Managed by Managed DevOps Pools", + "kind": "AzureDevOps", + "organizations": [{"openAccess": True, "url": "https://mseng.visualstudio.com"}], + "updateDescription": True, + }, + "provisioningState": "Succeeded", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-07-03-preview/CreateOrUpdatePool_InstanceMix.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py index 18c0e5cf2f59..9b60b735c181 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2024-10-19/DeletePool.json +# x-ms-original-file: 2026-07-03-preview/DeletePool.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py index b310a7c5b50a..c7a644b4ee3d 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-10-19/GetPool.json +# x-ms-original-file: 2026-07-03-preview/GetPool.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/image_versions_list_by_image.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/image_versions_list_by_image.py index 93a6cc0fd26c..f3b592d7a721 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/image_versions_list_by_image.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/image_versions_list_by_image.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/ImageVersions_ListByImage.json +# x-ms-original-file: 2026-07-03-preview/ImageVersions_ListByImage.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py index 9953b51a2180..4ba633c8c37a 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/ListOperations.json +# x-ms-original-file: 2026-07-03-preview/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py index 01fbc3deeecf..a1fc03188809 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/ListPoolsBySubscription.json +# x-ms-original-file: 2026-07-03-preview/ListPoolsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py index 44690730eddf..1470da7f76d9 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/ListPoolsBySubscriptionAndResourceGroup.json +# x-ms-original-file: 2026-07-03-preview/ListPoolsBySubscriptionAndResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/pools_check_name_availability.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/pools_check_name_availability.py new file mode 100644 index 000000000000..f1d355e6be3f --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/pools_check_name_availability.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.devopsinfrastructure import DevOpsInfrastructureMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python pools_check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevOpsInfrastructureMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pools.check_name_availability( + body={"name": "mydevopspool", "type": "Microsoft.DevOpsInfrastructure/pools"}, + ) + print(response) + + +# x-ms-original-file: 2026-07-03-preview/Pools_CheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/pools_delete_resources.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/pools_delete_resources.py new file mode 100644 index 000000000000..5884e76bdfc6 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/pools_delete_resources.py @@ -0,0 +1,48 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.devopsinfrastructure import DevOpsInfrastructureMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python pools_delete_resources.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevOpsInfrastructureMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.pools.delete_resources( + resource_group_name="my-resource-group", + pool_name="my-dev-ops-pool", + body={ + "resourceIds": [ + "/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-dev-ops-pool/resources/dd8cc705c_0", + "/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-dev-ops-pool/resources/dd8cc705c_1", + ] + }, + ) + + +# x-ms-original-file: 2026-07-03-preview/Pools_DeleteResources.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/resource_details_list_by_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/resource_details_list_by_pool.py index 4c34a6ddbf69..74569e24465d 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/resource_details_list_by_pool.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/resource_details_list_by_pool.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/ResourceDetails_ListByPool.json +# x-ms-original-file: 2026-07-03-preview/ResourceDetails_ListByPool.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/sku_list_by_location.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/sku_list_by_location.py index 530f60131b5d..e49bb76c4952 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/sku_list_by_location.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/sku_list_by_location.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/Sku_ListByLocation.json +# x-ms-original-file: 2026-07-03-preview/Sku_ListByLocation.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/subscription_usages_usages.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/subscription_usages_usages.py index c2605175de27..ad663b4a6fc2 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/subscription_usages_usages.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/subscription_usages_usages.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-19/SubscriptionUsages_Usages.json +# x-ms-original-file: 2026-07-03-preview/SubscriptionUsages_Usages.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/update_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/update_pool.py new file mode 100644 index 000000000000..2278054add2c --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/update_pool.py @@ -0,0 +1,60 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.devopsinfrastructure import DevOpsInfrastructureMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python update_pool.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevOpsInfrastructureMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.pools.begin_update( + resource_group_name="rg", + pool_name="pool", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "agentProfile": agent_profile, + "devCenterProjectResourceId": "str", + "fabricProfile": fabric_profile, + "maximumConcurrency": 0, + "organizationProfile": organization_profile, + "provisioningState": "str", + "runtimeConfiguration": {"workFolder": "str"}, + }, + "tags": {"str": "str"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-07-03-preview/UpdatePool.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations.py index 937e352ee1f8..61dee3258822 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations.py @@ -47,11 +47,12 @@ def test_pools_begin_create_or_update(self, resource_group): "name": "str", "properties": { "agentProfile": "agent_profile", - "devCenterProjectResourceId": "str", "fabricProfile": "fabric_profile", "maximumConcurrency": 0, "organizationProfile": "organization_profile", + "devCenterProjectResourceId": "str", "provisioningState": "str", + "runtimeConfiguration": {"workFolder": "str"}, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -89,6 +90,7 @@ def test_pools_begin_update(self, resource_group): "maximumConcurrency": 0, "organizationProfile": "organization_profile", "provisioningState": "str", + "runtimeConfiguration": {"workFolder": "str"}, }, "tags": {"str": "str"}, }, @@ -125,3 +127,25 @@ def test_pools_list_by_subscription(self, resource_group): result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pools_check_name_availability(self, resource_group): + response = self.client.pools.check_name_availability( + body={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pools_delete_resources(self, resource_group): + response = self.client.pools.delete_resources( + resource_group_name=resource_group.name, + pool_name="str", + body={"resourceIds": ["str"]}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations_async.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations_async.py index 14334ae0959a..6c7dedd593f5 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations_async.py +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_tests/test_dev_ops_infrastructure_mgmt_pools_operations_async.py @@ -49,11 +49,12 @@ async def test_pools_begin_create_or_update(self, resource_group): "name": "str", "properties": { "agentProfile": "agent_profile", - "devCenterProjectResourceId": "str", "fabricProfile": "fabric_profile", "maximumConcurrency": 0, "organizationProfile": "organization_profile", + "devCenterProjectResourceId": "str", "provisioningState": "str", + "runtimeConfiguration": {"workFolder": "str"}, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -93,6 +94,7 @@ async def test_pools_begin_update(self, resource_group): "maximumConcurrency": 0, "organizationProfile": "organization_profile", "provisioningState": "str", + "runtimeConfiguration": {"workFolder": "str"}, }, "tags": {"str": "str"}, }, @@ -132,3 +134,25 @@ async def test_pools_list_by_subscription(self, resource_group): result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pools_check_name_availability(self, resource_group): + response = await self.client.pools.check_name_availability( + body={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pools_delete_resources(self, resource_group): + response = await self.client.pools.delete_resources( + resource_group_name=resource_group.name, + pool_name="str", + body={"resourceIds": ["str"]}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml index 540da07d41af..8a4f5b8e89ff 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-devopsinfrastructure" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Devopsinfrastructure Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] +requires-python = ">=3.10" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.devopsinfrastructure._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-devopsinfrastructure" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Devopsinfrastructure Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" +title = "DevOpsInfrastructureMgmtClient" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml deleted file mode 100644 index c6c7474951e3..000000000000 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml +++ /dev/null @@ -1,12 +0,0 @@ -[packaging] -package_name = "azure-mgmt-devopsinfrastructure" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Devopsinfrastructure Management" -package_doc_id = "" -is_stable = true -is_arm = true -need_msrestazure = false -need_azuremgmtcore = true -sample_link = "" -exclude_folders = "" -title = "DevOpsInfrastructureMgmtClient" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py deleted file mode 100644 index fd8157cfb80b..000000000000 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-devopsinfrastructure" -PACKAGE_PPRINT_NAME = "Devopsinfrastructure Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -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) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", - ], - python_requires=">=3.8", -) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/tsp-location.yaml b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/tsp-location.yaml index b5833183bd67..dfb8d977bfd1 100644 --- a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/tsp-location.yaml +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/tsp-location.yaml @@ -1,4 +1,4 @@ -directory: specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management -commit: 95e89f00932d2a8f04ff80e28f8ce10ee586ca7d +directory: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/DevOpsInfrastructure +commit: 0e55128a206a1be3feb030e748074722e98e5dcf repo: Azure/azure-rest-api-specs additionalDirectories: