-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Introduce Backups #794
Introduce Backups #794
Conversation
@AVaksman thank you very much for the thorough review! I've made the changes (thank you for all of the suggestions) and left just one thing: #794 (comment). |
gaxOpts: options.gaxOptions, | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(err, ...resp: any[]) => { |
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 proper type for this is likely represented in the generated types from protobufjs - would be nice to use those please :)
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.
@AVaksman could you advise here? This was taken from your suggestion on the other PR. I'm fighting a lot of TypeScript errors when I tamper with this.
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 took a stab at it as a part of an existing PR #731 where I am differentiating bigtable.request
signature between NormalCallback
, LROCallback
and PaginatedCallback
export type RequestCallback<T = void, R = void> = T extends void
? LROCallback
: R extends void
? NormalCallback<T>
: PagedCallback<T, R>;
export interface NormalCallback<TResponse> {
(err: ServiceError | null, res?: TResponse): void;
}
export interface PagedCallback<Item, Response> {
(
err: ServiceError | null,
results?: Item[] | null,
nextQuery?: {} | null,
response?: Response | null
): void;
}
export interface LROCallback {
(
err: ServiceError | null,
operation?: Operation,
apiResponse?: IOperation
): void;
}
Then here the something like this would work
this.bigtable.request<
google.bigtable.admin.v2.IBackup,
google.bigtable.admin.v2.IListBackupsResponse
>(
{
client: 'BigtableInstanceAdminClient',
method: 'listAppProfiles',
reqOpts,
gaxOpts,
},
(err, IBackups, nextPageRequest, apiResponse) => {
if (err) {
callback(err);
return;
}
const backups = IBackups!.map(backup => {
const backupInstance = this.backup(backup.name!.split('/').pop()!);
backupInstance.metadata = backup;
return backupInstance;
});
const nextQuery = nextPageRequest!
? extend({}, options, nextPageRequest!)
: null;
callback(null, appProfiles, nextQuery, apiResponse!);
}
);
Is this an overkill?
bigtable.request
signature changes could be done in a separate PR in a non breaking way.
WDYT?
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.
If agree, I can do the bigtable.request
PR?
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.
Curious for @JustinBeckwith's thoughts. Whatever makes sense to you guys :)
For now, should I leave the code as-is? Also, please LMK if everything else looks correct so far and I'll get the tests going.
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 am ok with leaving this as is for now, and coming back around to improve the under types here later. I'm ok with it because I don't think they affect the public types. Not a big deal.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
2 similar comments
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
3 similar comments
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
Looks like you can't delete old @google-cla posts-- it'll just post it again 🤣 |
I've seen commenting "@googlebot I consent." have helped, @stephenplusplus |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
1 similar comment
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
This reverts commit 4c1b46b.
532920a
to
c96aad1
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
/** | ||
* An expression for specifying the sort order of the results of the request. | ||
* The string value should specify one or more fields in | ||
* {@link google.bigtable.admin.v2.Backup|Backup}. The full syntax is |
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.
Curiosity - have you generated the docs locally to make sure these links get rendered right?
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.
Hmm, well I don't actually know where that gets rendered. That's part of interface GetBackupsOptions
, and I can't find where it went. It's not linked to where we use it from the getBackups()
methods :. All of the other links from descriptions seem to work, though!
}, | ||
}; | ||
|
||
if (reqOpts.backup.expireTime instanceof Date) { |
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 used to be all kinds of nuance on when it was ok to use instanceof Date
, and you had to do weird tricks to detect date objects. It looks like is
now does exactly what you're doing here though:
https://github.com/sindresorhus/is/blob/master/source/index.ts
So I'm good with it :)
gaxOpts: options.gaxOptions, | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(err, ...resp: any[]) => { |
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 am ok with leaving this as is for now, and coming back around to improve the under types here later. I'm ok with it because I don't think they affect the public types. Not a big deal.
const callback = | ||
typeof optionsOrCallback === 'function' ? optionsOrCallback : cb!; | ||
|
||
options = extend(true, {}, 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.
I spent a year trying to remove extend
in favor of Object.assign
, and I just want to say out loud that @stephenplusplus was right all along and I was wrong.
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.
Hahaha, stdlib got so close on this one!
API Changes
Access or create Backup objects through a Cluster reference
Access Backup objects through an Instance reference
Create a Backup through a Table reference
Once you have a reference to a Backup object:
All methods below besides "restore()" are common CRUD methods defined throughout our API
References
To Dos
This PR splits the work from #761 into three parts-- source code, tests, and then documentation and samples to come in a follow-up PR. This should make reviewing easier, as well as lets us lock in the source code changes before attempting to adapt the previously written tests and samples.
Currently, this PR has only the source code. Most of it was carried from #761, but there were some structural changes to follow our conventions:
@AVaksman could you please review this when you get a chance? I will likely need special attention to the TypeScript, making sure I'm properly compliant with our conventions and use cases I may have missed. Thank you!