-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autorest violations fixes in RecoveryServices.Backup #1805
Merged
lmazuel
merged 3 commits into
Azure:restapi_auto_recoveryservicesbackup/resource-manager
from
AutorestCI:RestAPI-PR2208
Feb 21, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
432 changes: 310 additions & 122 deletions
432
azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/__init__.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ervicesbackup/azure/mgmt/recoveryservicesbackup/models/azure_file_share_backup_request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 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) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .backup_request import BackupRequest | ||
|
||
|
||
class AzureFileShareBackupRequest(BackupRequest): | ||
"""AzureFileShare workload-specific backup request. | ||
|
||
:param object_type: Constant filled by server. | ||
:type object_type: str | ||
:param recovery_point_expiry_time_in_utc: Backup copy will expire after | ||
the time specified (UTC). | ||
:type recovery_point_expiry_time_in_utc: datetime | ||
""" | ||
|
||
_validation = { | ||
'object_type': {'required': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'object_type': {'key': 'objectType', 'type': 'str'}, | ||
'recovery_point_expiry_time_in_utc': {'key': 'recoveryPointExpiryTimeInUTC', 'type': 'iso-8601'}, | ||
} | ||
|
||
def __init__(self, recovery_point_expiry_time_in_utc=None): | ||
super(AzureFileShareBackupRequest, self).__init__() | ||
self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc | ||
self.object_type = 'AzureFileShareBackupRequest' |
64 changes: 64 additions & 0 deletions
64
...vicesbackup/azure/mgmt/recoveryservicesbackup/models/azure_file_share_protectable_item.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# 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) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .workload_protectable_item import WorkloadProtectableItem | ||
|
||
|
||
class AzureFileShareProtectableItem(WorkloadProtectableItem): | ||
"""Protectable item for Azure Fileshare workloads. | ||
|
||
:param backup_management_type: Type of backup managemenent to backup an | ||
item. | ||
:type backup_management_type: str | ||
:param workload_type: Type of workload for the backup management | ||
:type workload_type: str | ||
:param friendly_name: Friendly name of the backup item. | ||
:type friendly_name: str | ||
:param protection_state: State of the back up item. Possible values | ||
include: 'Invalid', 'NotProtected', 'Protecting', 'Protected', | ||
'ProtectionFailed' | ||
:type protection_state: str or | ||
~azure.mgmt.recoveryservicesbackup.models.ProtectionStatus | ||
:param protectable_item_type: Constant filled by server. | ||
:type protectable_item_type: str | ||
:param parent_container_fabric_id: Full Fabric ID of container to which | ||
this protectable item belongs. For example, ARM ID. | ||
:type parent_container_fabric_id: str | ||
:param parent_container_friendly_name: Friendly name of container to which | ||
this protectable item belongs. | ||
:type parent_container_friendly_name: str | ||
:param azure_file_share_type: File Share type XSync or XSMB. Possible | ||
values include: 'Invalid', 'XSMB', 'XSync' | ||
:type azure_file_share_type: str or | ||
~azure.mgmt.recoveryservicesbackup.models.AzureFileShareType | ||
""" | ||
|
||
_validation = { | ||
'protectable_item_type': {'required': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, | ||
'workload_type': {'key': 'workloadType', 'type': 'str'}, | ||
'friendly_name': {'key': 'friendlyName', 'type': 'str'}, | ||
'protection_state': {'key': 'protectionState', 'type': 'str'}, | ||
'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, | ||
'parent_container_fabric_id': {'key': 'parentContainerFabricId', 'type': 'str'}, | ||
'parent_container_friendly_name': {'key': 'parentContainerFriendlyName', 'type': 'str'}, | ||
'azure_file_share_type': {'key': 'azureFileShareType', 'type': 'str'}, | ||
} | ||
|
||
def __init__(self, backup_management_type=None, workload_type=None, friendly_name=None, protection_state=None, parent_container_fabric_id=None, parent_container_friendly_name=None, azure_file_share_type=None): | ||
super(AzureFileShareProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state) | ||
self.parent_container_fabric_id = parent_container_fabric_id | ||
self.parent_container_friendly_name = parent_container_friendly_name | ||
self.azure_file_share_type = azure_file_share_type | ||
self.protectable_item_type = 'AzureFileShare' |
56 changes: 56 additions & 0 deletions
56
...icesbackup/azure/mgmt/recoveryservicesbackup/models/azure_file_share_protection_policy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .protection_policy import ProtectionPolicy | ||
|
||
|
||
class AzureFileShareProtectionPolicy(ProtectionPolicy): | ||
"""AzureStorage backup policy. | ||
|
||
:param protected_items_count: Number of items associated with this policy. | ||
:type protected_items_count: int | ||
:param backup_management_type: Constant filled by server. | ||
:type backup_management_type: str | ||
:param work_load_type: Type of workload for the backup management | ||
:type work_load_type: str | ||
:param schedule_policy: Backup schedule specified as part of backup | ||
policy. | ||
:type schedule_policy: | ||
~azure.mgmt.recoveryservicesbackup.models.SchedulePolicy | ||
:param retention_policy: Retention policy with the details on backup copy | ||
retention ranges. | ||
:type retention_policy: | ||
~azure.mgmt.recoveryservicesbackup.models.RetentionPolicy | ||
:param time_zone: TimeZone optional input as string. For example: TimeZone | ||
= "Pacific Standard Time". | ||
:type time_zone: str | ||
""" | ||
|
||
_validation = { | ||
'backup_management_type': {'required': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, | ||
'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, | ||
'work_load_type': {'key': 'workLoadType', 'type': 'str'}, | ||
'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, | ||
'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, | ||
'time_zone': {'key': 'timeZone', 'type': 'str'}, | ||
} | ||
|
||
def __init__(self, protected_items_count=None, work_load_type=None, schedule_policy=None, retention_policy=None, time_zone=None): | ||
super(AzureFileShareProtectionPolicy, self).__init__(protected_items_count=protected_items_count) | ||
self.work_load_type = work_load_type | ||
self.schedule_policy = schedule_policy | ||
self.retention_policy = retention_policy | ||
self.time_zone = time_zone | ||
self.backup_management_type = 'AzureStorage' |
46 changes: 46 additions & 0 deletions
46
...ervicesbackup/azure/mgmt/recoveryservicesbackup/models/azure_file_share_recovery_point.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 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) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .recovery_point import RecoveryPoint | ||
|
||
|
||
class AzureFileShareRecoveryPoint(RecoveryPoint): | ||
"""Azure File Share workload specific backup copy. | ||
|
||
:param object_type: Constant filled by server. | ||
:type object_type: str | ||
:param recovery_point_type: Type of the backup copy. Specifies whether it | ||
is a crash consistent backup or app consistent. | ||
:type recovery_point_type: str | ||
:param recovery_point_time: Time at which this backup copy was created. | ||
:type recovery_point_time: datetime | ||
:param file_share_snapshot_uri: Contains Url to the snapshot of fileshare, | ||
if applicable | ||
:type file_share_snapshot_uri: str | ||
""" | ||
|
||
_validation = { | ||
'object_type': {'required': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'object_type': {'key': 'objectType', 'type': 'str'}, | ||
'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, | ||
'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, | ||
'file_share_snapshot_uri': {'key': 'fileShareSnapshotUri', 'type': 'str'}, | ||
} | ||
|
||
def __init__(self, recovery_point_type=None, recovery_point_time=None, file_share_snapshot_uri=None): | ||
super(AzureFileShareRecoveryPoint, self).__init__() | ||
self.recovery_point_type = recovery_point_type | ||
self.recovery_point_time = recovery_point_time | ||
self.file_share_snapshot_uri = file_share_snapshot_uri | ||
self.object_type = 'AzureFileShareRecoveryPoint' |
66 changes: 66 additions & 0 deletions
66
...rvicesbackup/azure/mgmt/recoveryservicesbackup/models/azure_file_share_restore_request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 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) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .restore_request import RestoreRequest | ||
|
||
|
||
class AzureFileShareRestoreRequest(RestoreRequest): | ||
"""AzureFileShare Restore Request. | ||
|
||
:param object_type: Constant filled by server. | ||
:type object_type: str | ||
:param recovery_type: Type of this recovery. Possible values include: | ||
'Invalid', 'OriginalLocation', 'AlternateLocation', 'RestoreDisks' | ||
:type recovery_type: str or | ||
~azure.mgmt.recoveryservicesbackup.models.RecoveryType | ||
:param source_resource_id: Source storage account ARM Id | ||
:type source_resource_id: str | ||
:param copy_options: Options to resolve copy conflicts. Possible values | ||
include: 'Invalid', 'CreateCopy', 'Skip', 'Overwrite', 'FailOnConflict' | ||
:type copy_options: str or | ||
~azure.mgmt.recoveryservicesbackup.models.CopyOptions | ||
:param restore_request_type: Restore Type (FullShareRestore or | ||
ItemLevelRestore). Possible values include: 'Invalid', 'FullShareRestore', | ||
'ItemLevelRestore' | ||
:type restore_request_type: str or | ||
~azure.mgmt.recoveryservicesbackup.models.RestoreRequestType | ||
:param restore_file_specs: List of Source Files/Folders(which need to | ||
recover) and TargetFolderPath details | ||
:type restore_file_specs: | ||
list[~azure.mgmt.recoveryservicesbackup.models.RestoreFileSpecs] | ||
:param target_details: Target File Share Details | ||
:type target_details: | ||
~azure.mgmt.recoveryservicesbackup.models.TargetAFSRestoreInfo | ||
""" | ||
|
||
_validation = { | ||
'object_type': {'required': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'object_type': {'key': 'objectType', 'type': 'str'}, | ||
'recovery_type': {'key': 'recoveryType', 'type': 'str'}, | ||
'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, | ||
'copy_options': {'key': 'copyOptions', 'type': 'str'}, | ||
'restore_request_type': {'key': 'restoreRequestType', 'type': 'str'}, | ||
'restore_file_specs': {'key': 'restoreFileSpecs', 'type': '[RestoreFileSpecs]'}, | ||
'target_details': {'key': 'targetDetails', 'type': 'TargetAFSRestoreInfo'}, | ||
} | ||
|
||
def __init__(self, recovery_type=None, source_resource_id=None, copy_options=None, restore_request_type=None, restore_file_specs=None, target_details=None): | ||
super(AzureFileShareRestoreRequest, self).__init__() | ||
self.recovery_type = recovery_type | ||
self.source_resource_id = source_resource_id | ||
self.copy_options = copy_options | ||
self.restore_request_type = restore_request_type | ||
self.restore_file_specs = restore_file_specs | ||
self.target_details = target_details | ||
self.object_type = 'AzureFileShareRestoreRequest' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DheerendraRathor Could you confirm this is the actual EXACT case used by your endpoint?
We have some issues with the Swagger linter right now, where people fix the Swagger when they shouldn't and I become very careful when I see a case change.
If this is not the the EXACT case (case sensitive), a new PR needs to be made to fix the Swagger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service endpoints are case-insensitive, though these will be the actual cases returned by service.
Btw how deserialization is handled in msrest? Is it case-sensitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deserialization is case-sensitive in all SDK language except C#.... This is the expected behavior for a JSON return (JSON is case-sensitive).
We have trouble currently because:
TL;DR; If this is output from Azure, and if you return "DPMServers" in the actual JSON, it won't deserialize with "dpmServers".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, server will return "dpmServers". Though old SDKs will be broken then.
Regarding #1, I'll call that a feature as that is the common implementation across libraries is to be case insensitive. Since Python json library, deserializes into dict and not class instance, that creates problem in python (standard implementation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's common in the C# world to consider JSON case-insensitive, but not in other language :). I insist on others, it's Python, NodeJS and more language.
Note too that it's a requirement of Swagger:
https://swagger.io/specification/#format-11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So other than this, PR looks good to me for merge. Tests are failing which I'll update in separate PR.
Regarding deserialization of JSON in rest api - I'm speaking with my experience on Newtonsoft, Golang std JSON unmarshalling and Python framework Django-Rest-Framework. They all have fallback from case-sensitivity to case-insensitivity if there is no exact case match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DheerendraRathor I can't merge this PR with the broken tests, this would break my "master" CI. I gave you permissions to push in that branch:
https://github.com/AutorestCI/azure-sdk-for-python/invitations
You can also work from your fork and cherry-pick the generation from here, at your convenience.