Repository: cloudflare/cloudflare-go
Pull request #1477 (2024-01-09 21:19:46)

AUTH-5745 add default relay state for saas applications
Adds a string field of default_relay_state for access saas applications
## Description

<!--
Describe your changes in detail through motivation and context. Why is
this change required? What problem does it solve? If it fixes an open
issue, link to the issue using GitHub's closing issues keywords[1].
-->
## Has your change been tested?

Yes, via unit tests

## Screenshots (if appropriate):

## 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.

[1]: https://help.github.com/articles/closing-issues-using-keywords/



Patch:
diff --git a/.changelog/1477.txt b/.changelog/1477.txt
new file mode 100644
index 000000000..fad08d0c6
--- /dev/null
+++ b/.changelog/1477.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+access_application: Add support for default_relay_state in saas apps
+```
\ No newline at end of file
diff --git a/access_application.go b/access_application.go
index 6e62b2de2..98b240ae7 100644
--- a/access_application.go
+++ b/access_application.go
@@ -112,6 +112,7 @@ type SaasApplication struct {
 	IDPEntityID        string                `json:"idp_entity_id,omitempty"`
 	NameIDFormat       string                `json:"name_id_format,omitempty"`
 	SSOEndpoint        string                `json:"sso_endpoint,omitempty"`
+	DefaultRelayState  string                `json:"default_relay_state,omitempty"`
 	UpdatedAt          *time.Time            `json:"updated_at,omitempty"`
 	CreatedAt          *time.Time            `json:"created_at,omitempty"`
 	CustomAttributes   []SAMLAttributeConfig `json:"custom_attributes,omitempty"`


Test patch:
diff --git a/access_application_test.go b/access_application_test.go
index 6904b7c69..ed0916e03 100644
--- a/access_application_test.go
+++ b/access_application_test.go
@@ -646,6 +646,7 @@ func TestCreateSaasAccessApplications(t *testing.T) {
 					"consumer_service_url": "https://saas.example.com",
 					"sp_entity_id": "dash.example.com",
 					"name_id_format": "id",
+					"default_relay_state": "https://saas.example.com",
 					"custom_attributes": [
 						{
 							"name": "test1",
@@ -697,6 +698,7 @@ func TestCreateSaasAccessApplications(t *testing.T) {
 			ConsumerServiceUrl: "https://saas.example.com",
 			SPEntityID:         "dash.example.com",
 			NameIDFormat:       "id",
+			DefaultRelayState:  "https://saas.example.com",
 			CustomAttributes: []SAMLAttributeConfig{
 				{
 					Name:       "test1",