googleapis / googleapis/google-cloud-node
[DNS] Support GetRecordsRequest object for more granular filtering in Zone.replaceRecords()
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
### A screenshot that you have tested with "Try this API".
Currently, the replaceRecords method in the DNS Zone class only accepts a recordType parameter (string or string[]) for filtering records to delete before adding new ones. This is overly restrictive as it deletes ALL records of the specified type(s).
### Current signature:
```ts
replaceRecords(recordType: string | string[], records: Record | Record[]): Promise
```
### Current behavior:
```ts
await zone.replaceRecords("A", recordObject)
// This deletes ALL "A" records in the zone, which is often not desired
```
### What would you like to see in the library?
Allow the first parameter to accept a [GetRecordsRequest-like](https://github.com/googleapis/google-cloud-node/blob/0e789bac8803a06904ec0870f3a8c35826c1f161/packages/google-cloud-dns/src/zone.ts#L889) object for more granular filtering, enabling users to specify additional criteria like record name.
```ts
replaceRecords(
filter: string | string[] | GetRecordsRequest,
records: Record | Record[]
): Promise
```
### Desired usage:
```ts
await zone.replaceRecords({ type: "A", name: "oldRecordName" }, recordObject)
// This would only delete "A" records with the specific name "oldRecordName"
```
### Describe alternatives you've considered
Currently, users must manually:
- Query existing records with specific filters
- Create the DNS change manually
### Additional context/notes
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.