Skip to content

Commit

Permalink
code and test (Azure#24456)
Browse files Browse the repository at this point in the history
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
  • Loading branch information
azclibot authored May 18, 2022
1 parent 17850af commit fd661a7
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 51 deletions.
8 changes: 8 additions & 0 deletions sdk/servicelinker/azure-mgmt-servicelinker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History

## 1.1.0 (2022-05-16)

**Features**

- Added model AzureResourceType
- Added model TargetServiceType
- Added model ValidateOperationResult

## 1.0.0 (2022-04-22)

**Features**
Expand Down
1 change: 1 addition & 0 deletions sdk/servicelinker/azure-mgmt-servicelinker/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ include *.md
include azure/__init__.py
include azure/mgmt/__init__.py
include LICENSE
include azure/mgmt/servicelinker/py.typed
2 changes: 1 addition & 1 deletion sdk/servicelinker/azure-mgmt-servicelinker/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@autorest/python@5.13.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3",
"commit": "0cc5e2efd6ffccf30e80d1e150b488dd87198b94",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/servicelinker/resource-manager/readme.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0"
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ async def _validate_initial(
resource_uri: str,
linker_name: str,
**kwargs: Any
) -> Optional["_models.ValidateResult"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateResult"]]
) -> Optional["_models.ValidateOperationResult"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateOperationResult"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -577,7 +577,7 @@ async def _validate_initial(

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ValidateResult', pipeline_response)
deserialized = self._deserialize('ValidateOperationResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
Expand All @@ -593,7 +593,7 @@ async def begin_validate(
resource_uri: str,
linker_name: str,
**kwargs: Any
) -> AsyncLROPoller["_models.ValidateResult"]:
) -> AsyncLROPoller["_models.ValidateOperationResult"]:
"""Validate a link.
:param resource_uri: The fully qualified Azure Resource manager identifier of the resource to
Expand All @@ -609,14 +609,15 @@ async def begin_validate(
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ValidateResult or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateResult]
:return: An instance of AsyncLROPoller that returns either ValidateOperationResult or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2022-05-01") # type: str
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateOperationResult"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
Expand All @@ -634,7 +635,7 @@ async def begin_validate(

def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
deserialized = self._deserialize('ValidateResult', pipeline_response)
deserialized = self._deserialize('ValidateOperationResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@
from ._models_py3 import TargetServiceBase
from ._models_py3 import UserAssignedIdentityAuthInfo
from ._models_py3 import VNetSolution
from ._models_py3 import ValidateResult
from ._models_py3 import ValidateOperationResult
from ._models_py3 import ValidationResultItem
from ._models_py3 import ValueSecretInfo


from ._service_linker_management_client_enums import (
ActionType,
AuthType,
AzureResourceType,
ClientType,
CreatedByType,
Origin,
SecretType,
Type,
TargetServiceType,
VNetSolutionType,
ValidationResultStatus,
)
Expand Down Expand Up @@ -86,16 +87,17 @@
'TargetServiceBase',
'UserAssignedIdentityAuthInfo',
'VNetSolution',
'ValidateResult',
'ValidateOperationResult',
'ValidationResultItem',
'ValueSecretInfo',
'ActionType',
'AuthType',
'AzureResourceType',
'ClientType',
'CreatedByType',
'Origin',
'SecretType',
'Type',
'TargetServiceType',
'VNetSolutionType',
'ValidationResultStatus',
]
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class AzureResourcePropertiesBase(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
:ivar type: Required. The azure resource type.Constant filled by server. Possible values
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.Type
include: "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType
"""

_validation = {
Expand Down Expand Up @@ -92,8 +92,8 @@ class AzureKeyVaultProperties(AzureResourcePropertiesBase):
All required parameters must be populated in order to send to Azure.
:ivar type: Required. The azure resource type.Constant filled by server. Possible values
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.Type
include: "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType
:ivar connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver.
:vartype connect_as_kubernetes_csi_driver: bool
"""
Expand Down Expand Up @@ -131,8 +131,8 @@ class TargetServiceBase(msrest.serialization.Model):
All required parameters must be populated in order to send to Azure.
:ivar type: Required. The target service type.Constant filled by server. Possible values
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.Type
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry".
:vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType
"""

_validation = {
Expand Down Expand Up @@ -163,8 +163,8 @@ class AzureResource(TargetServiceBase):
All required parameters must be populated in order to send to Azure.
:ivar type: Required. The target service type.Constant filled by server. Possible values
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.Type
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry".
:vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType
:ivar id: The Id of azure resource.
:vartype id: str
:ivar resource_properties: The azure resource connection related properties.
Expand Down Expand Up @@ -206,8 +206,8 @@ class ConfluentBootstrapServer(TargetServiceBase):
All required parameters must be populated in order to send to Azure.
:ivar type: Required. The target service type.Constant filled by server. Possible values
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.Type
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry".
:vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType
:ivar endpoint: The endpoint of service.
:vartype endpoint: str
"""
Expand Down Expand Up @@ -242,8 +242,8 @@ class ConfluentSchemaRegistry(TargetServiceBase):
All required parameters must be populated in order to send to Azure.
:ivar type: Required. The target service type.Constant filled by server. Possible values
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", "KeyVault".
:vartype type: str or ~azure.mgmt.servicelinker.models.Type
include: "AzureResource", "ConfluentBootstrapServer", "ConfluentSchemaRegistry".
:vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType
:ivar endpoint: The endpoint of service.
:vartype endpoint: str
"""
Expand Down Expand Up @@ -1264,9 +1264,13 @@ def __init__(
self.subscription_id = subscription_id


class ValidateResult(msrest.serialization.Model):
"""The validation result for a linker.
class ValidateOperationResult(msrest.serialization.Model):
"""The validation operation result for a linker.
:ivar resource_id: Validated linker id.
:vartype resource_id: str
:ivar status: Validation operation status.
:vartype status: str
:ivar linker_name: The linker name.
:vartype linker_name: str
:ivar is_connection_available: A boolean value indicating whether the connection is available
Expand All @@ -1288,19 +1292,23 @@ class ValidateResult(msrest.serialization.Model):
"""

_attribute_map = {
'linker_name': {'key': 'linkerName', 'type': 'str'},
'is_connection_available': {'key': 'isConnectionAvailable', 'type': 'bool'},
'report_start_time_utc': {'key': 'reportStartTimeUtc', 'type': 'iso-8601'},
'report_end_time_utc': {'key': 'reportEndTimeUtc', 'type': 'iso-8601'},
'source_id': {'key': 'sourceId', 'type': 'str'},
'target_id': {'key': 'targetId', 'type': 'str'},
'auth_type': {'key': 'authType', 'type': 'str'},
'validation_detail': {'key': 'validationDetail', 'type': '[ValidationResultItem]'},
'resource_id': {'key': 'resourceId', 'type': 'str'},
'status': {'key': 'status', 'type': 'str'},
'linker_name': {'key': 'properties.linkerName', 'type': 'str'},
'is_connection_available': {'key': 'properties.isConnectionAvailable', 'type': 'bool'},
'report_start_time_utc': {'key': 'properties.reportStartTimeUtc', 'type': 'iso-8601'},
'report_end_time_utc': {'key': 'properties.reportEndTimeUtc', 'type': 'iso-8601'},
'source_id': {'key': 'properties.sourceId', 'type': 'str'},
'target_id': {'key': 'properties.targetId', 'type': 'str'},
'auth_type': {'key': 'properties.authType', 'type': 'str'},
'validation_detail': {'key': 'properties.validationDetail', 'type': '[ValidationResultItem]'},
}

def __init__(
self,
*,
resource_id: Optional[str] = None,
status: Optional[str] = None,
linker_name: Optional[str] = None,
is_connection_available: Optional[bool] = None,
report_start_time_utc: Optional[datetime.datetime] = None,
Expand All @@ -1312,6 +1320,10 @@ def __init__(
**kwargs
):
"""
:keyword resource_id: Validated linker id.
:paramtype resource_id: str
:keyword status: Validation operation status.
:paramtype status: str
:keyword linker_name: The linker name.
:paramtype linker_name: str
:keyword is_connection_available: A boolean value indicating whether the connection is
Expand All @@ -1331,7 +1343,9 @@ def __init__(
:keyword validation_detail: The detail of validation result.
:paramtype validation_detail: list[~azure.mgmt.servicelinker.models.ValidationResultItem]
"""
super(ValidateResult, self).__init__(**kwargs)
super(ValidateOperationResult, self).__init__(**kwargs)
self.resource_id = resource_id
self.status = status
self.linker_name = linker_name
self.is_connection_available = is_connection_available
self.report_start_time_utc = report_start_time_utc
Expand All @@ -1349,7 +1363,7 @@ class ValidationResultItem(msrest.serialization.Model):
:vartype name: str
:ivar description: The display name of validation item.
:vartype description: str
:ivar result: The result of validation. Possible values include: "success", "failed",
:ivar result: The result of validation. Possible values include: "success", "failure",
"warning".
:vartype result: str or ~azure.mgmt.servicelinker.models.ValidationResultStatus
:ivar error_message: The error message of validation result.
Expand Down Expand Up @@ -1381,7 +1395,7 @@ def __init__(
:paramtype name: str
:keyword description: The display name of validation item.
:paramtype description: str
:keyword result: The result of validation. Possible values include: "success", "failed",
:keyword result: The result of validation. Possible values include: "success", "failure",
"warning".
:paramtype result: str or ~azure.mgmt.servicelinker.models.ValidationResultStatus
:keyword error_message: The error message of validation result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class AuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
SERVICE_PRINCIPAL_CERTIFICATE = "servicePrincipalCertificate"
SECRET = "secret"

class AzureResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The azure resource type.
"""

KEY_VAULT = "KeyVault"

class ClientType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The application client type
"""
Expand Down Expand Up @@ -68,21 +74,20 @@ class SecretType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
KEY_VAULT_SECRET_URI = "keyVaultSecretUri"
KEY_VAULT_SECRET_REFERENCE = "keyVaultSecretReference"

class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class TargetServiceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The target service type.
"""

AZURE_RESOURCE = "AzureResource"
CONFLUENT_BOOTSTRAP_SERVER = "ConfluentBootstrapServer"
CONFLUENT_SCHEMA_REGISTRY = "ConfluentSchemaRegistry"
KEY_VAULT = "KeyVault"

class ValidationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
"""The result of validation
"""

SUCCESS = "success"
FAILED = "failed"
FAILURE = "failure"
WARNING = "warning"

class VNetSolutionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@ def _validate_initial(
resource_uri: str,
linker_name: str,
**kwargs: Any
) -> Optional["_models.ValidateResult"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateResult"]]
) -> Optional["_models.ValidateOperationResult"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateOperationResult"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -832,7 +832,7 @@ def _validate_initial(

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ValidateResult', pipeline_response)
deserialized = self._deserialize('ValidateOperationResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
Expand All @@ -848,7 +848,7 @@ def begin_validate(
resource_uri: str,
linker_name: str,
**kwargs: Any
) -> LROPoller["_models.ValidateResult"]:
) -> LROPoller["_models.ValidateOperationResult"]:
"""Validate a link.
:param resource_uri: The fully qualified Azure Resource manager identifier of the resource to
Expand All @@ -864,14 +864,14 @@ def begin_validate(
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ValidateResult or the result of
:return: An instance of LROPoller that returns either ValidateOperationResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateResult]
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2022-05-01") # type: str
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateOperationResult"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
Expand All @@ -889,7 +889,7 @@ def begin_validate(

def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
deserialized = self._deserialize('ValidateResult', pipeline_response)
deserialized = self._deserialize('ValidateOperationResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
Expand Down
4 changes: 4 additions & 0 deletions sdk/servicelinker/azure-mgmt-servicelinker/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
'azure',
'azure.mgmt',
]),
include_package_data=True,
package_data={
'pytyped': ['py.typed'],
},
install_requires=[
'msrest>=0.6.21',
'azure-common~=1.1',
Expand Down

0 comments on commit fd661a7

Please sign in to comment.