-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Key Vault Admin] Convenience layer - KeyVaultBackupClient #11009
Conversation
* @param sasToken The SAS token. | ||
* @param [options] The optional parameters. | ||
*/ | ||
public async beginBackup( |
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.
python has it as begin_full_backup
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.
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.
cc: @christothes , @heaths
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.
.NET guidelines specify start*
but I don't see any specific guidance around naming for the other langs.
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 JS we favor "begin". Assuming that this prefix is fine, what I'm most concerned is of the full
part.
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.
I don't have a strong opinion here, but I opted for plain backup
because there is no other backup operation to contrast with.
sasToken: string; | ||
requestOptions?: BeginBackupOptions; | ||
intervalInMs?: number; | ||
resumeFrom?: string; |
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.
this is more of a question, but I thought I saw a continuation_token
property in some of your other poller options (or was that paging options)
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.
The continuation token is part of the internal implementation. It's hidden from the public API here, but it's definitely there!
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.
Found some typos, but looks good otherwise!
* ```ts | ||
* const client = new KeyVaultBackupClient(url, credentials); | ||
* | ||
* const blobStorageUri = "<blob-storage-uri>"; // <Blob storage URL>/<folder name> |
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 the folder name is a separate argument.
* const blobStorageUri = "<blob-storage-uri>"; // <Blob storage URL>/<folder name> | |
* const blobStorageUri = "<blob-storage-uri>"; |
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.
@christothes I thought the same, but my tests pass with the same parameters I'm using in the others, which satisfy: <Blob storage URL>/<folder name>
. Do you have different parameters for these tests?
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.
Oh, you are correct, sorry!
Co-authored-by: Christopher Scott <chriscott@hotmail.com>
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.
This all looks good to go, I left some comments but I think they're all style/preference things.
/** | ||
* Status of the restore operation. | ||
*/ | ||
status?: string; |
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.
doesn't this always have some kind of known status, even if it's like "started" or something?
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.
Also it would be nice if this was a string union, but maybe we don't have that kind of safety?
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.
This property comes from the service! And, the swagger doesn't have a set of possible values :/ I could ask though. What do you think after this information?
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.
Note: this property is not part of core-lro, it's part of the service we're using for this client.
|
||
let response: KeyVaultClientFullRestoreOperationResponse; | ||
try { | ||
response = await client.fullRestoreOperation(vaultUrl, setParentSpan(span, options)); |
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.
optional nit: you could do the assignment and return inside the try block if you wanted:
try {
const response = await client.fullRestoreOperation(vaultUrl, setParentSpan(span, options));
return response;
} finally {
span.end();
}
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.
Does that still allow the span.end() to run? 😮 I can also just return client.full*
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.
returns inside a try still execute the finally, but you'll want to do an await
or else the time spent inside the promise won't be tracked by the span
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.
ohh thank you
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.
I like the API, nice work.
@bterlson thank you! |
The Backup Client source code.
IMPORTANT:
getOperationState
to show the other values of the pending operation. This gets extended by the properties of the generated code's operation.You can see the tests here: #11010
This PR will fail until these PRs are merged:
[Key Vault Admin] Convenience layer - KeyVaultAccessControlClient [Key Vault Admin] Convenience layer - KeyVaultAccessControlClient #10815Merged.[Key Vault Admin] No LROs on the generated code for now [Key Vault Admin] No LROs on the generated code for now #11008Merged.For: #10799