Skip to content
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

[Hub Generated] Review request for Microsoft.RecoveryServices to add version 2018-07-10 #5207

Conversation

sriramvu
Copy link
Contributor

@sriramvu sriramvu commented Feb 15, 2019

If you are a MSFT employee you can view your work branch via this link.

Contribution checklist:

@AutorestCI
Copy link

AutorestCI commented Feb 15, 2019

Automation for azure-sdk-for-python

Nothing to generate for azure-sdk-for-python

@AutorestCI
Copy link

AutorestCI commented Feb 15, 2019

Automation for azure-sdk-for-ruby

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-ruby#2261

@AutorestCI
Copy link

AutorestCI commented Feb 15, 2019

Automation for azure-sdk-for-go

Nothing to generate for azure-sdk-for-go

@AutorestCI
Copy link

AutorestCI commented Feb 15, 2019

Automation for azure-sdk-for-java

Nothing to generate for azure-sdk-for-java

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@AutorestCI
Copy link

AutorestCI commented Feb 15, 2019

Automation for azure-sdk-for-node

A PR has been created for you based on this PR content.

Once this PR will be merged, content will be added to your service PR:
Azure/azure-sdk-for-node#4747

@AutorestCI
Copy link

AutorestCI commented Feb 15, 2019

Automation for azure-sdk-for-js

Encountered an unknown error: (azure-sdk-for-js)

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/azure_devtools/ci_tools/github_tools.py", line 33, in exception_to_github
    yield context
  File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github.py", line 170, in rest_handle_action
    return rest_pull_close(body, restapi_repo, sdk_pr_target_repo, sdkbase, sdk_tag)
  File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github.py", line 185, in rest_pull_close
    rest_pr_management(rest_pr, sdk_pr_target_repo, sdk_tag, sdk_default_base)
  File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github_handler.py", line 151, in rest_pr_management
    sdk_tag=sdk_tag
  File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/SwaggerToSdkNewCLI.py", line 309, in generate_sdk_from_git_object
    sdk_repo.git.push('origin', base_branch, set_upstream=True)
  File "/usr/local/lib/python3.6/dist-packages/git/cmd.py", line 548, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/git/cmd.py", line 1014, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/git/cmd.py", line 825, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git push --set-upstream origin restapi_auto_recoveryservicessiterecovery/resource-manager
  stderr: 'remote: Permission to Azure/azure-sdk-for-js.git denied to AutorestCI.
fatal: unable to access 'https://AutorestCI:58ab395c311d1bd75b3e1db1cc8adaf9acc42afe@github.com/Azure/azure-sdk-for-js.git/': The requested URL returned error: 403'

@sriramvu
Copy link
Contributor Author

Introduced new API version 2018-07-10 for Azure Site Recovery (ASR) service:

Breaking changes:

  • modified properties in InMageAzureV2EnableProtectionInput and InMageAzureV2ReplicationDetails using new contracts InMageAzureV2DiskInputDetails and InMageAzureV2ManagedDiskDetails
  • removed roleAssignment

Incremental changes:

  • new APIs addDisks, removeDisks, resolveHealthErrors, replicationSupportedOperatingSystems got added

Ran autorest --azure-validator and sanity tools under OpenAPI Validation Tools and found no issues.

"type": "string"
},
{
"name": "migrationI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolvability -> Resolvable? Could just be a boolean that way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, we thought of the boolean approach. But decided against it, due to the limitation in future extendability if we ever wanted a new value apart from the current set i.e Allowed, NotAllowed.

@praries880 praries880 added the WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required label Feb 19, 2019
Copy link
Contributor

@ravbhatnagar ravbhatnagar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few comments

@@ -3322,6 +3476,83 @@
}
}
},
"/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/ResolveHealthErrors": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: camel case for subscriptions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will be taking later as it reflects all the existing APIs too.

@@ -3180,6 +3257,83 @@
}
}
},
"/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure linked access check is happening in ARM manifest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @innosam has communicated over mail, we are updating manifest in parallel.

@@ -7189,6 +7485,17 @@
"description": "The data pending at source virtual machine in MB.",
"type": "number"
},
"diskState": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be modeled as enum

Copy link
Contributor

@innosam innosam Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know using enums is not considered a good practice. Are you are referring to allowed values construct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is enums not a good practice? you can set modelasString:true and that will not be a breaking change when you add new values.

@@ -8127,13 +8502,6 @@
"type": "string"
}
},
"roleAssignments": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this property being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Om Nishant omnishan@microsoft.com: After the roles and responsibilities were revisited to keep up with compliance and customer expectations, extraneous fields were removed to prevent any misleading and unrealistic expectations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when customer sets this property using an old api-version which supported it and gets the resource using new api-version. And then may be after that, does a PUT again from the new api-version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roleAssignments under AzureToAzureVmSyncedConfigDetails is present only in response of GET ReplicationProtectedItem.

Actually these are role assignments of the Virtual Machine that is getting replicated (Virtual Machine and ReplicationProtectedItem have 1:1 association in ASR).
We were storing & syncing roleAssignments of the Virtual Machine - which we have stopped doing (shared the reason from Om Nishant in previous comment).

So, there is no PUT and only GET associated with the property which we have removed.

@ravbhatnagar
Copy link
Contributor

There is an open issue with this design which is due to a limitation in ASR service and second this has already been implemented on service side. Ideally addDisk, removeDisk, resolveHealthError kind of scenarios should have been addressed via a PUT or PATCH on the parent resource instead of as a POST action. Please make sure you are doing the right auth check in the manifest
Pasting email conversation below for some context -

_Gaurav Bhatnagar
Thu 11/15/2018 12:39 AM
Sure, please let me know if you have questions on Linked access checks.
Please note this is not an ideal API design. More so, when it seems like this path was chosen to overcome engineering complexities/challenges. We strongly discourage the use of POST to change resource models like in this case. Imagine if every service in Azure starts enabling POST APIs to update certain properties on the resources it owns. Soon the API surface in Azure will become confusing, inconsistent and hard to use. But since this is already implemented/deployed on the service side, we cant change it now.
Apologies again for missing this thread earlier.
Thanks,
Gaurav

Sent from Outlook
Harkirat Singh
Tue 11/13/2018 10:38 PM
Please find the comments inline.

From: Gaurav Bhatnagar Gaurav.Bhatnagar@microsoft.com
Sent: 14 November 2018 02:42
To: Harkirat Singh hsingh@microsoft.com
Cc: Himanshu Saini Himanshu.Saini@microsoft.com; Mukesh Kumar (CDAP) mukeshk@microsoft.com; Vijay Narayan vijay.narayan@microsoft.com; Azure Resource Manager RP API Review armapireview@microsoft.com
Subject: Re: SiteRecovery API to support add/remove protected disks
Ok, both these are not ideal. Wanted to clarify a couple of things -

For #1 comment below - Does the second PUT fail on an existing resource fail if some property values are changed in the payload. If a property is patchable using a PATCH API, it should be updatable using a PUT as well.

I can confirm that for replication protected item, the second PUT call with the same input is handled idempotence. While, if some of the input is changed, we fail with a user error.

#2a -Seems like an internal implementation detail.

yes this is specific to asr, but the jobs are available as ARM resource replicationJobs/{jobname}.

And, when the get is done on the resource we expose the list of task executed for a particular long running job.

#2b - IMO, it doesn't complicate the scenario. May be it complicates the implementation on the backend. But, as far as user experience is concerned, it provides flexibility to the user. The user can choose to update any number of properties as part of the patch. the user doesn't have to update a few properties using PATCH and somehow figure out that for disk update they need a separate POST API.

Yes, it does complicate the implementation. From user experience perspective, the bright side for the POST call is that user need not provided the existing disk set and their parameters, when adding a new disk.

Moreover, in the current model, RBAC is broken. Since now someone without /write permissions on replicationProtectedItems can change its state by doing a POST.

It looks like this has already been implemented. Can you please confirm? If yes, I would recommend that we atleast do a linked access check to ensure the RBAC is not an issue.

Yes, we have already completed the implementation. I will definitely ensure that the linked access check to ensure the RBAC is not an issue.

Thanks for bringing this point, I will reach you if I have doubts on “how to” of this required action.

Thanks,

Gaurav

Sent from Outlook

From: Harkirat Singh
Sent: Tuesday, November 13, 2018 1:39 AM
To: Gaurav Bhatnagar
Cc: Himanshu Saini; Mukesh Kumar (CDAP); Vijay Narayan
Subject: RE: SiteRecovery API to support add/remove protected disks

Hey Gaurav,

I was away last week for Diwali holidays, so could not respond.

Yes, we did consider the PATCH/PUT call, and eventually decided on separate POST due to following reasons:

PUT
The site recovery service was not designed to have PUT calls update the parameters.

            So, currently none of our PUT calls support update.

PATCH
We do have a PATCH call on the protected item, where multiple parameters can be updated.

            But using this verb for add/remove disks have following cons for us:

a. The PATCH call fires a workflow/job which is generic in nature.

The add/remove disk scenario needed descriptive task which are different from the current PATCH.

b. And, if we do allow the disk update through PATCH, user can club different updates together with add/remove disk, which complicates the scenario.

In summary separate API’s is more convenient to the user as only the diff of the disk needs to be provided.

Thanks

Harkirat Singh_

@ravbhatnagar ravbhatnagar added the ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review label Feb 20, 2019
@ravbhatnagar
Copy link
Contributor

@sriramvu - just one pending open question

}
],
"properties": {
"vmDisksUris": {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is naming fine DisksUris?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

property names should also be camel cased.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vmDisksUris is camel cased, did not get the comment.
Suggesting a change?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vmDiskUris

double plural is odd

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is correct. I thought you asked a question and I replied saying es, propertynames should also be camel cased.

Copy link

@viverm viverm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service is already out with changes.
No point in holding things for this minor things.

}
],
"properties": {
"vmDisksUris": {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vmDiskUris

double plural is odd

@ravbhatnagar
Copy link
Contributor

Signing off from ARM side.

@ravbhatnagar ravbhatnagar added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants