Skip to content

Commit

Permalink
code and test (#27489)
Browse files Browse the repository at this point in the history
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
  • Loading branch information
azure-sdk authored Nov 17, 2022
1 parent 3e4d0f0 commit cc0acf9
Show file tree
Hide file tree
Showing 43 changed files with 5,547 additions and 1,288 deletions.
8 changes: 8 additions & 0 deletions sdk/oep/azure-mgmt-oep/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History

## 1.0.0b2 (2022-11-15)

### Features Added

- Added operation EnergyServicesOperations.begin_add_partition
- Added operation EnergyServicesOperations.begin_remove_partition
- Added operation EnergyServicesOperations.list_partitions

## 1.0.0b1 (2022-02-15)

* Initial Release
4 changes: 3 additions & 1 deletion sdk/oep/azure-mgmt-oep/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include _meta.json
recursive-include tests *.py *.yaml
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/oep/py.typed
2 changes: 0 additions & 2 deletions sdk/oep/azure-mgmt-oep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For


To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)



For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Oep Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Expand Down
12 changes: 6 additions & 6 deletions sdk/oep/azure-mgmt-oep/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"commit": "83d42b77e751deafcf46784877922ec1538f41c6",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@5.12.0",
"@autorest/modelerfour@4.19.3"
"@autorest/python@6.2.1",
"@autorest/modelerfour@4.24.3"
],
"commit": "8ccb47875370596cf1992aa2a8997b8ce3861486",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/oep/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
"autorest_command": "autorest specification/oep/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.2 --version-tolerant=False",
"readme": "specification/oep/resource-manager/readme.md"
}
18 changes: 13 additions & 5 deletions sdk/oep/azure-mgmt-oep/azure/mgmt/oep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@
from ._version import VERSION

__version__ = VERSION
__all__ = ['OpenEnergyPlatformManagementServiceAPIs']

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"OpenEnergyPlatformManagementServiceAPIs",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
57 changes: 33 additions & 24 deletions sdk/oep/azure-mgmt-oep/azure/mgmt/oep/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -14,55 +15,63 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

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


class OpenEnergyPlatformManagementServiceAPIsConfiguration(Configuration):
class OpenEnergyPlatformManagementServiceAPIsConfiguration(
Configuration
): # pylint: disable=too-many-instance-attributes
"""Configuration for OpenEnergyPlatformManagementServiceAPIs.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-04-04-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(OpenEnergyPlatformManagementServiceAPIsConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-04-04-preview") # type: Literal["2022-04-04-preview"]

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-06-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-oep/{}'.format(VERSION))
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-oep/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
self, **kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)
104 changes: 0 additions & 104 deletions sdk/oep/azure-mgmt-oep/azure/mgmt/oep/_metadata.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,39 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, Optional, TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

from . import models
from ._configuration import OpenEnergyPlatformManagementServiceAPIsConfiguration
from ._serialization import Deserializer, Serializer
from .operations import EnergyServicesOperations, LocationsOperations, Operations

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

class OpenEnergyPlatformManagementServiceAPIs:

class OpenEnergyPlatformManagementServiceAPIs: # pylint: disable=client-accepts-api-version-keyword
"""Open Energy Platform Management Service APIs.
:ivar locations: LocationsOperations operations
:vartype locations: open_energy_platform_management_service_apis.operations.LocationsOperations
:vartype locations: azure.mgmt.oep.operations.LocationsOperations
:ivar energy_services: EnergyServicesOperations operations
:vartype energy_services:
open_energy_platform_management_service_apis.operations.EnergyServicesOperations
:vartype energy_services: azure.mgmt.oep.operations.EnergyServicesOperations
:ivar operations: Operations operations
:vartype operations: open_energy_platform_management_service_apis.operations.Operations
:param credential: Credential needed for the client to connect to Azure.
:vartype operations: azure.mgmt.oep.operations.Operations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-04-04-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
Expand All @@ -48,7 +51,9 @@ def __init__(
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = OpenEnergyPlatformManagementServiceAPIsConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = OpenEnergyPlatformManagementServiceAPIsConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand All @@ -59,12 +64,7 @@ def __init__(
self.energy_services = EnergyServicesOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)


def _send_request(
self,
request, # type: HttpRequest
**kwargs: Any
) -> HttpResponse:
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
Expand All @@ -73,7 +73,7 @@ def _send_request(
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
Expand Down
2 changes: 1 addition & 1 deletion sdk/oep/azure-mgmt-oep/azure/mgmt/oep/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass
Loading

0 comments on commit cc0acf9

Please sign in to comment.