Repository: cloudflare/cloudflare-go (go)

Issue:
Add GET for /dcv_delegation/uuid
### Current cloudflare-go version

0.76.0

### Description

https://api.cloudflare.com/client/v4/zones/<zone_id>/dcv_delegation/uuid is not currently supported by the Go SDK. 

### Use cases

We need the ability to automate partial zone CNAME DCV delegation after zone creation in order to allow certificates to be auto-renewed.

### Potential cloudflare-go usage

```go
Simple Go SDK support for new endpoint.
```


### References

_No response_

Pull request:
Add GET for DCV Delegation UUID endpoint

## Description

https://api.cloudflare.com/client/v4/zones/<zone_id>/dcv_delegation/uuid is not currently supported by the Go SDK.
closes #1383 

## Has your change been tested?

Unit tests added in changes

## Types of changes

What sort of change does your code introduce/modify?

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

- [X] My code follows the code style of this project.
- [X] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [x] This change is using publicly documented in [cloudflare/api-schemas](https://github.com/cloudflare/api-schemas) 
      and relies on stable APIs.


Patch:
diff --git a/.changelog/1384.txt b/.changelog/1384.txt
new file mode 100644
index 000000000..83a5c51b8
--- /dev/null
+++ b/.changelog/1384.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+dcv_delegation: add GET for DCV Delegation UUID
+```
diff --git a/dcv_delegation.go b/dcv_delegation.go
new file mode 100644
index 000000000..db66db273
--- /dev/null
+++ b/dcv_delegation.go
@@ -0,0 +1,41 @@
+package cloudflare
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+
+	"github.com/goccy/go-json"
+)
+
+type DCVDelegation struct {
+	UUID string `json:"uuid"`
+}
+
+// DCVDelegationResponse represents the response from the dcv_delegation/uuid endpoint.
+type DCVDelegationResponse struct {
+	Result DCVDelegation `json:"result"`
+	Response
+	ResultInfo `json:"result_info"`
+}
+
+type GetDCVDelegationParams struct{}
+
+// GetDCVDelegation gets a zone DCV Delegation UUID.
+//
+// API documentation: https://developers.cloudflare.com/api/operations/dcv-delegation-uuid-get
+func (api *API) GetDCVDelegation(ctx context.Context, rc *ResourceContainer, params GetDCVDelegationParams) (DCVDelegation, ResultInfo, error) {
+	uri := fmt.Sprintf("/zones/%s/dcv_delegation/uuid", rc.Identifier)
+
+	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
+	if err != nil {
+		return DCVDelegation{}, ResultInfo{}, err
+	}
+	var dcvResponse DCVDelegationResponse
+	err = json.Unmarshal(res, &dcvResponse)
+	if err != nil {
+		return DCVDelegation{}, ResultInfo{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
+	}
+
+	return dcvResponse.Result, dcvResponse.ResultInfo, nil
+}


Test patch:
diff --git a/dcv_delegation_test.go b/dcv_delegation_test.go
new file mode 100644
index 000000000..a7a0350b2
--- /dev/null
+++ b/dcv_delegation_test.go
@@ -0,0 +1,43 @@
+package cloudflare
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestGetDCVDelegation(t *testing.T) {
+	setup()
+	defer teardown()
+
+	testUuid := "b9ab465427f949ed"
+
+	handler := func(w http.ResponseWriter, r *http.Request) {
+		assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method)
+		w.Header().Set("content-type", "application/json")
+		fmt.Fprintf(w, `{
+	"success" : true,
+	"errors": [],
+	"messages": [],
+	"result": {
+		"uuid": "%s"
+	}
+}
+		`, testUuid)
+	}
+
+	mux.HandleFunc("/zones/"+testZoneID+"/dcv_delegation/uuid", handler)
+
+	want := DCVDelegation{
+		UUID: testUuid,
+	}
+
+	actual, _, err := client.GetDCVDelegation(context.Background(), ZoneIdentifier(testZoneID), GetDCVDelegationParams{})
+
+	if assert.NoError(t, err) {
+		assert.Equal(t, want, actual)
+	}
+}