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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions sdk/sphere/azure-mgmt-sphere/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"commit": "09c37754dac91874ff689ed1e60effb4268c8669",
"commit": "a2bd6a405683c01ba4bf92b47380d20e2306d991",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/sphere/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"readme": "specification/sphere/resource-manager/readme.md"
"typespec_src": "specification/sphere/Sphere.Management",
"@azure-tools/typespec-python": "0.40.0"
}
101 changes: 101 additions & 0 deletions sdk/sphere/azure-mgmt-sphere/apiview-properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"CrossLanguagePackageId": "Microsoft.AzureSphere",
"CrossLanguageDefinitionId": {
"azure.mgmt.sphere.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
"azure.mgmt.sphere.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
"azure.mgmt.sphere.models.Catalog": "Microsoft.AzureSphere.Catalog",
"azure.mgmt.sphere.models.CatalogProperties": "Microsoft.AzureSphere.CatalogProperties",
"azure.mgmt.sphere.models.CatalogUpdate": "Microsoft.AzureSphere.CatalogUpdate",
"azure.mgmt.sphere.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource",
"azure.mgmt.sphere.models.Certificate": "Microsoft.AzureSphere.Certificate",
"azure.mgmt.sphere.models.CertificateChainResponse": "Microsoft.AzureSphere.CertificateChainResponse",
"azure.mgmt.sphere.models.CertificateProperties": "Microsoft.AzureSphere.CertificateProperties",
"azure.mgmt.sphere.models.ClaimDevicesRequest": "Microsoft.AzureSphere.ClaimDevicesRequest",
"azure.mgmt.sphere.models.CountElementsResponse": "Microsoft.AzureSphere.CountElementsResponse",
"azure.mgmt.sphere.models.CountDevicesResponse": "Microsoft.AzureSphere.CountDevicesResponse",
"azure.mgmt.sphere.models.Deployment": "Microsoft.AzureSphere.Deployment",
"azure.mgmt.sphere.models.DeploymentProperties": "Microsoft.AzureSphere.DeploymentProperties",
"azure.mgmt.sphere.models.Device": "Microsoft.AzureSphere.Device",
"azure.mgmt.sphere.models.DeviceGroup": "Microsoft.AzureSphere.DeviceGroup",
"azure.mgmt.sphere.models.DeviceGroupProperties": "Microsoft.AzureSphere.DeviceGroupProperties",
"azure.mgmt.sphere.models.DeviceGroupUpdate": "Microsoft.AzureSphere.DeviceGroupUpdate",
"azure.mgmt.sphere.models.DeviceGroupUpdateProperties": "Microsoft.AzureSphere.DeviceGroupUpdateProperties",
"azure.mgmt.sphere.models.DeviceInsight": "Microsoft.AzureSphere.DeviceInsight",
"azure.mgmt.sphere.models.DeviceProperties": "Microsoft.AzureSphere.DeviceProperties",
"azure.mgmt.sphere.models.DeviceUpdate": "Microsoft.AzureSphere.DeviceUpdate",
"azure.mgmt.sphere.models.DeviceUpdateProperties": "Microsoft.AzureSphere.DeviceUpdateProperties",
"azure.mgmt.sphere.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
"azure.mgmt.sphere.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
"azure.mgmt.sphere.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
"azure.mgmt.sphere.models.GenerateCapabilityImageRequest": "Microsoft.AzureSphere.GenerateCapabilityImageRequest",
"azure.mgmt.sphere.models.Image": "Microsoft.AzureSphere.Image",
"azure.mgmt.sphere.models.ImageProperties": "Microsoft.AzureSphere.ImageProperties",
"azure.mgmt.sphere.models.ListDeviceGroupsRequest": "Microsoft.AzureSphere.ListDeviceGroupsRequest",
"azure.mgmt.sphere.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
"azure.mgmt.sphere.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
"azure.mgmt.sphere.models.Product": "Microsoft.AzureSphere.Product",
"azure.mgmt.sphere.models.ProductProperties": "Microsoft.AzureSphere.ProductProperties",
"azure.mgmt.sphere.models.ProductUpdate": "Microsoft.AzureSphere.ProductUpdate",
"azure.mgmt.sphere.models.ProductUpdateProperties": "Microsoft.AzureSphere.ProductUpdateProperties",
"azure.mgmt.sphere.models.ProofOfPossessionNonceRequest": "Microsoft.AzureSphere.ProofOfPossessionNonceRequest",
"azure.mgmt.sphere.models.ProofOfPossessionNonceResponse": "Microsoft.AzureSphere.ProofOfPossessionNonceResponse",
"azure.mgmt.sphere.models.SignedCapabilityImageResponse": "Microsoft.AzureSphere.SignedCapabilityImageResponse",
"azure.mgmt.sphere.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
"azure.mgmt.sphere.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
"azure.mgmt.sphere.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
"azure.mgmt.sphere.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
"azure.mgmt.sphere.models.ProvisioningState": "Microsoft.AzureSphere.ProvisioningState",
"azure.mgmt.sphere.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary",
"azure.mgmt.sphere.models.ImageType": "Microsoft.AzureSphere.ImageType",
"azure.mgmt.sphere.models.OSFeedType": "Microsoft.AzureSphere.OSFeedType",
"azure.mgmt.sphere.models.UpdatePolicy": "Microsoft.AzureSphere.UpdatePolicy",
"azure.mgmt.sphere.models.AllowCrashDumpCollection": "Microsoft.AzureSphere.AllowCrashDumpCollection",
"azure.mgmt.sphere.models.CertificateStatus": "Microsoft.AzureSphere.CertificateStatus",
"azure.mgmt.sphere.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType",
"azure.mgmt.sphere.AzureSphereMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.get": "Microsoft.AzureSphere.Catalogs.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.begin_create_or_update": "Microsoft.AzureSphere.Catalogs.createOrUpdate",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.update": "Microsoft.AzureSphere.Catalogs.update",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.begin_delete": "Microsoft.AzureSphere.Catalogs.delete",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_by_resource_group": "Microsoft.AzureSphere.Catalogs.listByResourceGroup",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_by_subscription": "Microsoft.AzureSphere.Catalogs.listBySubscription",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.count_devices": "Microsoft.AzureSphere.Catalogs.countDevices",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_deployments": "Microsoft.AzureSphere.Catalogs.listDeployments",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_device_groups": "Microsoft.AzureSphere.Catalogs.listDeviceGroups",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_device_insights": "Microsoft.AzureSphere.Catalogs.listDeviceInsights",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_devices": "Microsoft.AzureSphere.Catalogs.listDevices",
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.begin_upload_image": "Microsoft.AzureSphere.Catalogs.uploadImage",
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.get": "Microsoft.AzureSphere.Certificates.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.list_by_catalog": "Microsoft.AzureSphere.Certificates.listByCatalog",
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.retrieve_cert_chain": "Microsoft.AzureSphere.Certificates.retrieveCertChain",
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.retrieve_proof_of_possession_nonce": "Microsoft.AzureSphere.Certificates.retrieveProofOfPossessionNonce",
"azure.mgmt.sphere.AzureSphereMgmtClient.images.get": "Microsoft.AzureSphere.Images.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.images.begin_create_or_update": "Microsoft.AzureSphere.Images.createOrUpdate",
"azure.mgmt.sphere.AzureSphereMgmtClient.images.begin_delete": "Microsoft.AzureSphere.Images.delete",
"azure.mgmt.sphere.AzureSphereMgmtClient.images.list_by_catalog": "Microsoft.AzureSphere.Images.listByCatalog",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.get": "Microsoft.AzureSphere.Products.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.begin_create_or_update": "Microsoft.AzureSphere.Products.createOrUpdate",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.begin_update": "Microsoft.AzureSphere.Products.update",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.begin_delete": "Microsoft.AzureSphere.Products.delete",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.list_by_catalog": "Microsoft.AzureSphere.Products.listByCatalog",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.count_devices": "Microsoft.AzureSphere.Products.countDevices",
"azure.mgmt.sphere.AzureSphereMgmtClient.products.generate_default_device_groups": "Microsoft.AzureSphere.Products.generateDefaultDeviceGroups",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.get": "Microsoft.AzureSphere.DeviceGroups.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_create_or_update": "Microsoft.AzureSphere.DeviceGroups.createOrUpdate",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_update": "Microsoft.AzureSphere.DeviceGroups.update",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_delete": "Microsoft.AzureSphere.DeviceGroups.delete",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.list_by_product": "Microsoft.AzureSphere.DeviceGroups.listByProduct",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_claim_devices": "Microsoft.AzureSphere.DeviceGroups.claimDevices",
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.count_devices": "Microsoft.AzureSphere.DeviceGroups.countDevices",
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.get": "Microsoft.AzureSphere.Deployments.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.begin_create_or_update": "Microsoft.AzureSphere.Deployments.createOrUpdate",
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.begin_delete": "Microsoft.AzureSphere.Deployments.delete",
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.list_by_device_group": "Microsoft.AzureSphere.Deployments.listByDeviceGroup",
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.get": "Microsoft.AzureSphere.Devices.get",
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_create_or_update": "Microsoft.AzureSphere.Devices.createOrUpdate",
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_update": "Microsoft.AzureSphere.Devices.update",
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_delete": "Microsoft.AzureSphere.Devices.delete",
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.list_by_device_group": "Microsoft.AzureSphere.Devices.listByDeviceGroup",
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_generate_capability_image": "Microsoft.AzureSphere.Devices.generateCapabilityImage"
}
}
14 changes: 10 additions & 4 deletions sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._azure_sphere_mgmt_client import AzureSphereMgmtClient
from typing import TYPE_CHECKING

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

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

__version__ = VERSION

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

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

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

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

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

from . import models as _models
from ._configuration import AzureSphereMgmtClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
Expand All @@ -29,11 +29,10 @@
)

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


class AzureSphereMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
class AzureSphereMgmtClient: # pylint: disable=too-many-instance-attributes
"""Azure Sphere resource management API.

:ivar operations: Operations operations
Expand All @@ -52,14 +51,14 @@ class AzureSphereMgmtClient: # pylint: disable=client-accepts-api-version-keywo
:vartype deployments: azure.mgmt.sphere.operations.DeploymentsOperations
:ivar devices: DevicesOperations operations
:vartype devices: azure.mgmt.sphere.operations.DevicesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:param base_url: Service host. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Default value is "2024-04-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand All @@ -72,8 +71,9 @@ def __init__(
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = AzureSphereMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
)
_policies = kwargs.pop("policies", None)
if _policies is None:
Expand All @@ -93,11 +93,10 @@ def __init__(
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.catalogs = CatalogsOperations(self._client, self._config, self._serialize, self._deserialize)
Expand All @@ -108,13 +107,13 @@ def __init__(
self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize)

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

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

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
Expand All @@ -127,13 +126,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
"""

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

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

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

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

Expand Down
Loading