Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions rust/domains-client/openapi/domains.oas3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1034,73 +1034,6 @@
}
},
"/v3/domains/zones/{zone}/dns-records/{recordId}": {
"put": {
"operationId": "replaceDNSRecord",
"tags": [
"Records"
],
"summary": "Replace a DNS record",
"description": "Fully replaces an existing DNS resource record identified by\nrecordId within the zone. All writable fields (name, type, data,\nttl) must be supplied; partial updates are not supported on this\nendpoint. Changes are applied synchronously.\n\nGoDaddy-managed system records (SOA and NS) are read-only. When\nrecordId refers to such a record, the request fails with\n`409 Conflict` \u2014 the record exists but cannot be modified.\n",
"parameters": [
{
"$ref": "#/components/parameters/xRequestId"
},
{
"$ref": "#/components/parameters/xShopperId"
},
{
"$ref": "#/components/parameters/zonePath"
},
{
"$ref": "#/components/parameters/recordId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DNSRecord"
},
"examples": {
"apexARecord": {
"summary": "Replace apex A record",
"value": {
"name": "@",
"type": "A",
"data": "192.0.2.1",
"ttl": 3600
}
}
}
}
}
},
"security": [
{
"oauth2": [
"domains.dns:update"
]
}
],
"responses": {
"200": {
"description": "DNS record replaced.",
"headers": {
"X-Request-Id": {
"$ref": "#/components/headers/xRequestId"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DNSRecord"
}
}
}
}
}
},
"delete": {
"operationId": "deleteDNSRecord",
"tags": [
Expand Down
75 changes: 8 additions & 67 deletions rust/domains-client/openapi/swagger_domains.v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1035,74 +1035,15 @@ paths:
$ref: '#/components/responses/422'
'429':
$ref: '#/components/responses/429'
# NOTE: this path previously also had a `put` (operationId replaceDNSRecord).
# It's removed: despite returning 200, it does not perform a single-record
# replace — it silently replaces the entire dns-records collection with
# [system records] + [the one record in the body], discarding every other
# record in the zone. Reproduced live against a test zone; see
# https://github.com/godaddy/cli/issues/136. Do not reintroduce without a
# confirmed server-side fix and a fresh live check against a real zone with
# unrelated records.
/zones/{zone}/dns-records/{recordId}:
put:
operationId: replaceDNSRecord
tags:
- Records
summary: Replace a DNS record
description: 'Fully replaces an existing DNS resource record identified by

recordId within the zone. All writable fields (name, type, data,

ttl) must be supplied; partial updates are not supported on this

endpoint. Changes are applied synchronously.


GoDaddy-managed system records (SOA and NS) are read-only. When

recordId refers to such a record, the request fails with

`409 Conflict` — the record exists but cannot be modified.

'
parameters:
- $ref: '#/components/parameters/xRequestId'
- $ref: '#/components/parameters/xShopperId'
- $ref: '#/components/parameters/zonePath'
- $ref: '#/components/parameters/recordId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DNSRecord'
examples:
apexARecord:
summary: Replace apex A record
value:
name: '@'
type: A
data: 192.0.2.1
ttl: 3600
security:
- oauth2:
- domains.dns:update
responses:
'200':
description: DNS record replaced.
headers:
X-Request-Id:
$ref: '#/components/headers/xRequestId'
content:
application/json:
schema:
$ref: '#/components/schemas/DNSRecord'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'409':
$ref: '#/components/responses/409'
'422':
$ref: '#/components/responses/422'
'429':
$ref: '#/components/responses/429'
delete:
operationId: deleteDNSRecord
tags:
Expand Down
43 changes: 1 addition & 42 deletions rust/domains-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ mod tests {
assert_eq!(agreements[0].agreement_key.as_deref(), Some("DNRA"));
}

// --- v3: DNS list / replace / delete ------------------------------------
// --- v3: DNS list / delete -----------------------------------------------

#[tokio::test]
async fn list_dns_records_sends_filters_and_parses_collection() {
Expand Down Expand Up @@ -626,47 +626,6 @@ mod tests {
assert_eq!(items[0].data, "1.2.3.4");
}

#[tokio::test]
async fn replace_dns_record_puts_by_record_id() {
let server = MockServer::start_async().await;
let mock = server
.mock_async(|when, then| {
when.method(PUT)
.path("/v3/domains/zones/example.com/dns-records/rec-1")
.json_body(
json!({ "type": "A", "name": "www", "data": "5.6.7.8", "ttl": 600 }),
);
then.status(200).json_body(
json!({ "type": "A", "name": "www", "data": "5.6.7.8", "ttl": 600 }),
);
})
.await;

client_for(&server)
.replace_dns_record()
.zone("example.com")
.record_id("rec-1")
.body(types::DnsRecord {
data: "5.6.7.8".to_string(),
flag: None,
name: "www".to_string(),
port: None,
priority: None,
protocol: None,
record_id: None,
service: None,
tag: None,
ttl: 600,
type_: types::DnsRecordType("A".to_string()),
weight: None,
})
.send()
.await
.expect("request succeeds");

mock.assert_async().await;
}

#[tokio::test]
async fn delete_dns_record_deletes_by_record_id() {
let server = MockServer::start_async().await;
Expand Down
63 changes: 0 additions & 63 deletions rust/schemas/api/domains.json
Original file line number Diff line number Diff line change
Expand Up @@ -2877,69 +2877,6 @@
],
"summary": "Create a DNS record for a zone"
},
{
"description": "Fully replaces an existing DNS resource record identified by\nrecordId within the zone. All writable fields (name, type, data,\nttl) must be supplied; partial updates are not supported on this\nendpoint. Changes are applied synchronously.\n\nGoDaddy-managed system records (SOA and NS) are read-only. When\nrecordId refers to such a record, the request fails with\n`409 Conflict` — the record exists but cannot be modified.\n",
"method": "PUT",
"operationId": "replaceDNSRecord",
"parameters": [
{
"description": "Optional client-generated request correlation identifier, propagated across services and returned in the response X-Request-Id header.\n",
"in": "header",
"name": "X-Request-Id",
"required": false,
"schema": {
"type": "string"
}
},
{
"description": "Reseller acting on behalf of a shopper account. When present, all domain operations are scoped to the specified shopper. Absent, the authenticated entity's own account is used. Only valid for reseller OAuth tokens.\n",
"in": "header",
"name": "X-Shopper-Id",
"required": false,
"schema": {
"type": "string"
}
},
{
"description": "The domain name in punycode A-label form (e.g., example.com). For IDNs, use the punycode representation.\n",
"in": "path",
"name": "zone",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Server-assigned DNS record identifier within the zone.",
"in": "path",
"name": "recordId",
"required": true,
"schema": {
"type": "string"
}
}
],
"path": "/v3/domains/zones/{zone}/dns-records/{recordId}",
"requestBody": {
"contentType": "application/json",
"required": true,
"schema": {
"$ref": "#/$defs/DNSRecord"
}
},
"responses": {
"200": {
"description": "DNS record replaced.",
"schema": {
"$ref": "#/$defs/DNSRecord"
}
}
},
"scopes": [
"domains.dns:update"
],
"summary": "Replace a DNS record"
},
{
"description": "Permanently removes a DNS resource record from the zone. The\nrecordId must refer to an existing record within the specified\nzone. Changes are applied synchronously.\n\nGoDaddy-managed system records (SOA and NS) are read-only. When\nrecordId refers to such a record, the request fails with\n`409 Conflict` — the record exists but cannot be deleted.\n",
"method": "DELETE",
Expand Down
2 changes: 1 addition & 1 deletion rust/schemas/api/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"domains": {
"file": "domains.json",
"title": "Domain Lifecycle Management API",
"endpointCount": 15
"endpointCount": 14
}
}
}
23 changes: 22 additions & 1 deletion rust/src/dns/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ fn dry_run_delete_preview(
"deleted": would_delete,
"failed": would_fail,
"records": records,
"action": "would delete",
// "would delete" reads oddly with nothing matched (0 records, 0
// deletes) — call out the no-match case explicitly rather than
// implying a delete that has nothing to act on.
"action": if existing.is_empty() {
"nothing to delete"
} else {
"would delete"
},
})
}

Expand Down Expand Up @@ -298,6 +305,20 @@ mod tests {
assert_eq!(records[1]["status"], "would fail (missing recordId)");
}

/// Nothing matched — "would delete" would misleadingly imply a delete
/// with no target; the preview should say so plainly instead.
#[test]
fn dry_run_delete_preview_reports_nothing_to_delete_on_zero_match() {
let preview = dry_run_delete_preview("example.com", "A", "www", &[]);
assert_eq!(preview["deleted"], 0);
assert_eq!(preview["failed"], 0);
assert_eq!(preview["action"], "nothing to delete");
assert_eq!(
preview["records"].as_array().expect("records array").len(),
0
);
}

/// The command's `--output json` path always projects through
/// `default_fields` when the user doesn't pass `--fields` — a preview
/// field that isn't in that list is silently stripped and never reaches
Expand Down
Loading