Repository: cloudflare/cloudflare-go
Pull request #1497 (2024-02-05 14:44:52)

DLP-1479: added support for Context Awareness in DLP profiles
<!-- 
Provide a general summary of your changes in the title above. You should
remove this overview, any sections and any section descriptions you
don't need below before submitting. There isn't a strict requirement to
use this template if you can structure your description and still cover
these points. 
-->

## Description

Context Awareness was missing for DLP Profiles. This PR adds support for Context Awareness, and its ability to skip context awareness for files.

<!--
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?

Unit tests updated to match desired behaviour.

<!--
Explain how the change has been tested and what you ran to confirm your
change affects other parts of the code. Automated tests are generally
expected and changes without tests should explain why they aren't
required.
-->

## Types of changes

What sort of change does your code introduce/modify?

- [x] 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.
      **There is a sister ticket, DLP-1633 which focuses on adding this to our OpenAPI spec**

[1]: https://help.github.com/articles/closing-issues-using-keywords/


github-actions[bot]: changelog detected :white_check_mark:

Patch:
diff --git a/.changelog/1494.txt b/.changelog/1494.txt
deleted file mode 100644
index ad6abdd66..000000000
--- a/.changelog/1494.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-```release-note:enhancement
-images_variants: Add support for Images Variants CRUD operations
-```
diff --git a/.changelog/1496.txt b/.changelog/1496.txt
deleted file mode 100644
index 5d3ea2857..000000000
--- a/.changelog/1496.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-```release-note:enhancement
-access_application: Add support for `allow_authenticate_via_warp`
-```
-
-```release-note:enhancement
-access_organization: Add support for `allow_authenticate_via_warp` and `warp_auth_session_duration`
-```
diff --git a/.changelog/1497.txt b/.changelog/1497.txt
new file mode 100644
index 000000000..7bcaa6101
--- /dev/null
+++ b/.changelog/1497.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+dlp: add support for Context Awareness in DLP profiles
+```
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b641307ef..932ae1fa2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,10 +2,7 @@
 
 ENHANCEMENTS:
 
-* access_application: Add support for `allow_authenticate_via_warp` ([#1496](https://github.com/cloudflare/cloudflare-go/issues/1496))
-* access_organization: Add support for `allow_authenticate_via_warp` and `warp_auth_session_duration` ([#1496](https://github.com/cloudflare/cloudflare-go/issues/1496))
 * hyperdrive: Add support for hyperdrive CRUD operations ([#1492](https://github.com/cloudflare/cloudflare-go/issues/1492))
-* images_variants: Add support for Images Variants CRUD operations ([#1494](https://github.com/cloudflare/cloudflare-go/issues/1494))
 
 ## 0.87.0 (January 31st, 2024)
 
diff --git a/access_application.go b/access_application.go
index f61065991..98b240ae7 100644
--- a/access_application.go
+++ b/access_application.go
@@ -52,7 +52,6 @@ type AccessApplication struct {
 	HttpOnlyCookieAttribute  *bool                          `json:"http_only_cookie_attribute,omitempty"`
 	ServiceAuth401Redirect   *bool                          `json:"service_auth_401_redirect,omitempty"`
 	PathCookieAttribute      *bool                          `json:"path_cookie_attribute,omitempty"`
-	AllowAuthenticateViaWarp *bool                          `json:"allow_authenticate_via_warp,omitempty"`
 	CustomPages              []string                       `json:"custom_pages,omitempty"`
 	Tags                     []string                       `json:"tags,omitempty"`
 	AccessAppLauncherCustomization
@@ -167,7 +166,6 @@ type CreateAccessApplicationParams struct {
 	SessionDuration          string                         `json:"session_duration,omitempty"`
 	SkipInterstitial         *bool                          `json:"skip_interstitial,omitempty"`
 	Type                     AccessApplicationType          `json:"type,omitempty"`
-	AllowAuthenticateViaWarp *bool                          `json:"allow_authenticate_via_warp,omitempty"`
 	CustomPages              []string                       `json:"custom_pages,omitempty"`
 	Tags                     []string                       `json:"tags,omitempty"`
 	AccessAppLauncherCustomization
@@ -198,7 +196,6 @@ type UpdateAccessApplicationParams struct {
 	SessionDuration          string                         `json:"session_duration,omitempty"`
 	SkipInterstitial         *bool                          `json:"skip_interstitial,omitempty"`
 	Type                     AccessApplicationType          `json:"type,omitempty"`
-	AllowAuthenticateViaWarp *bool                          `json:"allow_authenticate_via_warp,omitempty"`
 	CustomPages              []string                       `json:"custom_pages,omitempty"`
 	Tags                     []string                       `json:"tags,omitempty"`
 	AccessAppLauncherCustomization
diff --git a/access_organization.go b/access_organization.go
index f7eea16af..bb02b1ca4 100644
--- a/access_organization.go
+++ b/access_organization.go
@@ -22,8 +22,6 @@ type AccessOrganization struct {
 	AutoRedirectToIdentity         *bool                         `json:"auto_redirect_to_identity,omitempty"`
 	SessionDuration                *string                       `json:"session_duration,omitempty"`
 	CustomPages                    AccessOrganizationCustomPages `json:"custom_pages,omitempty"`
-	WarpAuthSessionDuration        *string                       `json:"warp_auth_session_duration,omitempty"`
-	AllowAuthenticateViaWarp       *bool                         `json:"allow_authenticate_via_warp,omitempty"`
 }
 
 // AccessOrganizationLoginDesign represents the login design options.
@@ -69,8 +67,6 @@ type CreateAccessOrganizationParams struct {
 	AutoRedirectToIdentity         *bool                         `json:"auto_redirect_to_identity,omitempty"`
 	SessionDuration                *string                       `json:"session_duration,omitempty"`
 	CustomPages                    AccessOrganizationCustomPages `json:"custom_pages,omitempty"`
-	WarpAuthSessionDuration        *string                       `json:"warp_auth_session_duration,omitempty"`
-	AllowAuthenticateViaWarp       *bool                         `json:"allow_authenticate_via_warp,omitempty"`
 }
 
 type UpdateAccessOrganizationParams struct {
@@ -83,8 +79,6 @@ type UpdateAccessOrganizationParams struct {
 	AutoRedirectToIdentity         *bool                         `json:"auto_redirect_to_identity,omitempty"`
 	SessionDuration                *string                       `json:"session_duration,omitempty"`
 	CustomPages                    AccessOrganizationCustomPages `json:"custom_pages,omitempty"`
-	WarpAuthSessionDuration        *string                       `json:"warp_auth_session_duration,omitempty"`
-	AllowAuthenticateViaWarp       *bool                         `json:"allow_authenticate_via_warp,omitempty"`
 }
 
 func (api *API) GetAccessOrganization(ctx context.Context, rc *ResourceContainer, params GetAccessOrganizationParams) (AccessOrganization, ResultInfo, error) {
diff --git a/dlp_profile.go b/dlp_profile.go
index 28e0c6677..b53f84adb 100644
--- a/dlp_profile.go
+++ b/dlp_profile.go
@@ -35,17 +35,30 @@ type DLPEntry struct {
 	UpdatedAt *time.Time  `json:"updated_at,omitempty"`
 }
 
+// Content types to exclude from context analysis and return all matches.
+type DLPContextAwarenessSkip struct {
+	// Return all matches, regardless of context analysis result, if the data is a file.
+	Files *bool `json:"files,omitempty"`
+}
+
+// Scan the context of predefined entries to only return matches surrounded by keywords.
+type DLPContextAwareness struct {
+	Enabled *bool                   `json:"enabled,omitempty"`
+	Skip    DLPContextAwarenessSkip `json:"skip"`
+}
+
 // DLPProfile represents a DLP Profile, which contains a set
 // of entries.
 type DLPProfile struct {
-	ID                string `json:"id,omitempty"`
-	Name              string `json:"name,omitempty"`
-	Type              string `json:"type,omitempty"`
-	Description       string `json:"description,omitempty"`
-	AllowedMatchCount int    `json:"allowed_match_count"`
+	ID                string              `json:"id,omitempty"`
+	Name              string              `json:"name,omitempty"`
+	Type              string              `json:"type,omitempty"`
+	Description       string              `json:"description,omitempty"`
+	AllowedMatchCount int                 `json:"allowed_match_count"`
+	ContextAwareness  DLPContextAwareness `json:"context_awareness,omitempty"`
 
 	// The following fields are omitted for predefined DLP
-	// profiles
+	// profiles.
 	Entries   []DLPEntry `json:"entries,omitempty"`
 	CreatedAt *time.Time `json:"created_at,omitempty"`
 	UpdatedAt *time.Time `json:"updated_at,omitempty"`
diff --git a/images_variants.go b/images_variants.go
deleted file mode 100644
index 294955116..000000000
--- a/images_variants.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package cloudflare
-
-import (
-	"context"
-	"fmt"
-	"net/http"
-
-	"github.com/goccy/go-json"
-)
-
-type ImagesVariant struct {
-	ID                     string                `json:"id,omitempty"`
-	NeverRequireSignedURLs *bool                 `json:"neverRequireSignedURLs,omitempty"`
-	Options                ImagesVariantsOptions `json:"options,omitempty"`
-}
-
-type ImagesVariantsOptions struct {
-	Fit      string `json:"fit,omitempty"`
-	Height   int    `json:"height,omitempty"`
-	Metadata string `json:"metadata,omitempty"`
-	Width    int    `json:"width,omitempty"`
-}
-
-type ListImageVariantsParams struct{}
-
-type ListImagesVariantsResponse struct {
-	Result ListImageVariantsResult `json:"result,omitempty"`
-	Response
-}
-
-type ListImageVariantsResult struct {
-	ImagesVariants map[string]ImagesVariant `json:"variants,omitempty"`
-}
-
-type CreateImagesVariantParams struct {
-	ID                     string                `json:"id,omitempty"`
-	NeverRequireSignedURLs *bool                 `json:"neverRequireSignedURLs,omitempty"`
-	Options                ImagesVariantsOptions `json:"options,omitempty"`
-}
-
-type UpdateImagesVariantParams struct {
-	ID                     string                `json:"-"`
-	NeverRequireSignedURLs *bool                 `json:"neverRequireSignedURLs,omitempty"`
-	Options                ImagesVariantsOptions `json:"options,omitempty"`
-}
-
-type ImagesVariantResult struct {
-	Variant ImagesVariant `json:"variant,omitempty"`
-}
-
-type ImagesVariantResponse struct {
-	Result ImagesVariantResult `json:"result,omitempty"`
-	Response
-}
-
-// Lists existing variants.
-//
-// API Reference: https://developers.cloudflare.com/api/operations/cloudflare-images-variants-list-variants
-func (api *API) ListImagesVariants(ctx context.Context, rc *ResourceContainer, params ListImageVariantsParams) (ListImageVariantsResult, error) {
-	if rc.Identifier == "" {
-		return ListImageVariantsResult{}, ErrMissingAccountID
-	}
-
-	baseURL := fmt.Sprintf("/accounts/%s/images/v1/variants", rc.Identifier)
-	res, err := api.makeRequestContext(ctx, http.MethodGet, baseURL, nil)
-	if err != nil {
-		return ListImageVariantsResult{}, err
-	}
-
-	var listImageVariantsResponse ListImagesVariantsResponse
-	err = json.Unmarshal(res, &listImageVariantsResponse)
-	if err != nil {
-		return ListImageVariantsResult{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
-	}
-
-	return listImageVariantsResponse.Result, nil
-}
-
-// Fetch details for a single variant.
-//
-// API Reference: https://developers.cloudflare.com/api/operations/cloudflare-images-variants-variant-details
-func (api *API) GetImagesVariant(ctx context.Context, rc *ResourceContainer, variantID string) (ImagesVariant, error) {
-	if rc.Identifier == "" {
-		return ImagesVariant{}, ErrMissingAccountID
-	}
-
-	baseURL := fmt.Sprintf("/accounts/%s/images/v1/variants/%s", rc.Identifier, variantID)
-	res, err := api.makeRequestContext(ctx, http.MethodGet, baseURL, nil)
-	if err != nil {
-		return ImagesVariant{}, err
-	}
-
-	var imagesVariantDetailResponse ImagesVariantResponse
-	err = json.Unmarshal(res, &imagesVariantDetailResponse)
-	if err != nil {
-		return ImagesVariant{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
-	}
-
-	return imagesVariantDetailResponse.Result.Variant, nil
-}
-
-// Specify variants that allow you to resize images for different use cases.
-//
-// API Reference: https://developers.cloudflare.com/api/operations/cloudflare-images-variants-create-a-variant
-func (api *API) CreateImagesVariant(ctx context.Context, rc *ResourceContainer, params CreateImagesVariantParams) (ImagesVariant, error) {
-	if rc.Identifier == "" {
-		return ImagesVariant{}, ErrMissingAccountID
-	}
-
-	baseURL := fmt.Sprintf("/accounts/%s/images/v1/variants", rc.Identifier)
-	res, err := api.makeRequestContext(ctx, http.MethodPost, baseURL, params)
-	if err != nil {
-		return ImagesVariant{}, err
-	}
-
-	var createImagesVariantResponse ImagesVariantResponse
-	err = json.Unmarshal(res, &createImagesVariantResponse)
-	if err != nil {
-		return ImagesVariant{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
-	}
-
-	return createImagesVariantResponse.Result.Variant, nil
-}
-
-// Deleting a variant purges the cache for all images associated with the variant.
-//
-// API Reference: https://developers.cloudflare.com/api/operations/cloudflare-images-variants-variant-details
-func (api *API) DeleteImagesVariant(ctx context.Context, rc *ResourceContainer, variantID string) error {
-	if rc.Identifier == "" {
-		return ErrMissingAccountID
-	}
-
-	baseURL := fmt.Sprintf("/accounts/%s/images/v1/variants/%s", rc.Identifier, variantID)
-	_, err := api.makeRequestContext(ctx, http.MethodDelete, baseURL, nil)
-	if err != nil {
-		return fmt.Errorf("%s: %w", errMakeRequestError, err)
-	}
-
-	return nil
-}
-
-// Updating a variant purges the cache for all images associated with the variant.
-//
-// API Reference: https://developers.cloudflare.com/api/operations/cloudflare-images-variants-variant-details
-func (api *API) UpdateImagesVariant(ctx context.Context, rc *ResourceContainer, params UpdateImagesVariantParams) (ImagesVariant, error) {
-	if rc.Identifier == "" {
-		return ImagesVariant{}, ErrMissingAccountID
-	}
-
-	baseURL := fmt.Sprintf("/accounts/%s/images/v1/variants/%s", rc.Identifier, params.ID)
-	res, err := api.makeRequestContext(ctx, http.MethodPatch, baseURL, params)
-	if err != nil {
-		return ImagesVariant{}, err
-	}
-
-	var imagesVariantDetailResponse ImagesVariantResponse
-	err = json.Unmarshal(res, &imagesVariantDetailResponse)
-	if err != nil {
-		return ImagesVariant{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
-	}
-
-	return imagesVariantDetailResponse.Result.Variant, nil
-}


Test patch:
diff --git a/access_application_test.go b/access_application_test.go
index 4bf414b2b..ed0916e03 100644
--- a/access_application_test.go
+++ b/access_application_test.go
@@ -49,8 +49,7 @@ func TestAccessApplications(t *testing.T) {
 					"service_auth_401_redirect": true,
 					"path_cookie_attribute": true,
 					"custom_pages": ["480f4f69-1a28-4fdd-9240-1ed29f0ac1dc"],
-					"tags": ["engineers"],
-					"allow_authenticate_via_warp": true
+					"tags": ["engineers"]
 				}
 			],
 			"result_info": {
@@ -90,7 +89,6 @@ func TestAccessApplications(t *testing.T) {
 		CustomPages:              []string{"480f4f69-1a28-4fdd-9240-1ed29f0ac1dc"},
 		Tags:                     []string{"engineers"},
 		CustomNonIdentityDenyURL: "https://blocked.com",
-		AllowAuthenticateViaWarp: BoolPtr(true),
 	}}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/access/apps", handler)
@@ -142,8 +140,7 @@ func TestAccessApplication(t *testing.T) {
 				"app_launcher_visible": true,
 				"service_auth_401_redirect": true,
 				"http_only_cookie_attribute": false,
-				"path_cookie_attribute": false,
-				"allow_authenticate_via_warp": false
+				"path_cookie_attribute": false
 			}
 		}
 		`)
@@ -174,7 +171,6 @@ func TestAccessApplication(t *testing.T) {
 		HttpOnlyCookieAttribute:  BoolPtr(false),
 		PathCookieAttribute:      BoolPtr(false),
 		CustomNonIdentityDenyURL: "https://blocked.com",
-		AllowAuthenticateViaWarp: BoolPtr(false),
 	}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler)
@@ -225,8 +221,7 @@ func TestCreateAccessApplications(t *testing.T) {
 				"skip_interstitial": true,
 				"app_launcher_visible": true,
 				"service_auth_401_redirect": true,
-				"tags": ["engineers"],
-				"allow_authenticate_via_warp": false
+				"tags": ["engineers"]
 			}
 		}
 		`)
@@ -255,7 +250,6 @@ func TestCreateAccessApplications(t *testing.T) {
 		UpdatedAt:                &updatedAt,
 		CustomNonIdentityDenyURL: "https://blocked.com",
 		Tags:                     []string{"engineers"},
-		AllowAuthenticateViaWarp: BoolPtr(false),
 	}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/access/apps", handler)
@@ -314,8 +308,7 @@ func TestUpdateAccessApplication(t *testing.T) {
 				"skip_interstitial": true,
 				"app_launcher_visible": true,
 				"service_auth_401_redirect": true,
-				"tags": ["engineers"],
-				"allow_authenticate_via_warp": true
+				"tags": ["engineers"]
 			}
 		}
 		`)
@@ -340,7 +333,6 @@ func TestUpdateAccessApplication(t *testing.T) {
 		CustomNonIdentityDenyURL: "https://blocked.com",
 		Tags:                     []string{"engineers"},
 		SkipInterstitial:         BoolPtr(true),
-		AllowAuthenticateViaWarp: BoolPtr(true),
 		CreatedAt:                &createdAt,
 		UpdatedAt:                &updatedAt,
 	}
@@ -364,7 +356,6 @@ func TestUpdateAccessApplication(t *testing.T) {
 		SkipInterstitial:         BoolPtr(true),
 		CustomNonIdentityDenyURL: "https://blocked.com",
 		Tags:                     []string{"engineers"},
-		AllowAuthenticateViaWarp: BoolPtr(true),
 	}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler)
diff --git a/access_organization_test.go b/access_organization_test.go
index fc9cfb4bf..295a7f7d8 100644
--- a/access_organization_test.go
+++ b/access_organization_test.go
@@ -29,8 +29,6 @@ func TestAccessOrganization(t *testing.T) {
 				"is_ui_read_only": false,
 				"user_seat_expiration_inactive_time": "720h",
 				"auto_redirect_to_identity": true,
-				"allow_authenticate_via_warp": true,
-				"warp_auth_session_duration": "24h",
 				"session_duration": "12h",
 				"login_design": {
 					"background_color": "#c5ed1b",
@@ -48,12 +46,10 @@ func TestAccessOrganization(t *testing.T) {
 	updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 
 	want := AccessOrganization{
-		Name:                     "Widget Corps Internal Applications",
-		CreatedAt:                &createdAt,
-		UpdatedAt:                &updatedAt,
-		AuthDomain:               "test.cloudflareaccess.com",
-		AllowAuthenticateViaWarp: BoolPtr(true),
-		WarpAuthSessionDuration:  StringPtr("24h"),
+		Name:       "Widget Corps Internal Applications",
+		CreatedAt:  &createdAt,
+		UpdatedAt:  &updatedAt,
+		AuthDomain: "test.cloudflareaccess.com",
 		LoginDesign: AccessOrganizationLoginDesign{
 			BackgroundColor: "#c5ed1b",
 			LogoPath:        "https://example.com/logo.png",
@@ -100,8 +96,6 @@ func TestCreateAccessOrganization(t *testing.T) {
 				"updated_at": "2014-01-01T05:20:00.12345Z",
 				"name": "Widget Corps Internal Applications",
 				"auth_domain": "test.cloudflareaccess.com",
-				"allow_authenticate_via_warp": true,
-				"warp_auth_session_duration": "24h",
 				"is_ui_read_only": true,
 				"session_duration": "12h",
 				"login_design": {
@@ -120,12 +114,10 @@ func TestCreateAccessOrganization(t *testing.T) {
 	updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 
 	want := AccessOrganization{
-		CreatedAt:                &createdAt,
-		UpdatedAt:                &updatedAt,
-		Name:                     "Widget Corps Internal Applications",
-		AuthDomain:               "test.cloudflareaccess.com",
-		AllowAuthenticateViaWarp: BoolPtr(true),
-		WarpAuthSessionDuration:  StringPtr("24h"),
+		CreatedAt:  &createdAt,
+		UpdatedAt:  &updatedAt,
+		Name:       "Widget Corps Internal Applications",
+		AuthDomain: "test.cloudflareaccess.com",
 		LoginDesign: AccessOrganizationLoginDesign{
 			BackgroundColor: "#c5ed1b",
 			LogoPath:        "https://example.com/logo.png",
@@ -194,8 +186,6 @@ func TestUpdateAccessOrganization(t *testing.T) {
 				"updated_at": "2014-01-01T05:20:00.12345Z",
 				"name": "Widget Corps Internal Applications",
 				"auth_domain": "test.cloudflareaccess.com",
-				"allow_authenticate_via_warp": false,
-				"warp_auth_session_duration": "18h",
 				"login_design": {
 					"background_color": "#c5ed1b",
 					"logo_path": "https://example.com/logo.png",
@@ -215,12 +205,10 @@ func TestUpdateAccessOrganization(t *testing.T) {
 	updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 
 	want := AccessOrganization{
-		CreatedAt:                &createdAt,
-		UpdatedAt:                &updatedAt,
-		Name:                     "Widget Corps Internal Applications",
-		AuthDomain:               "test.cloudflareaccess.com",
-		WarpAuthSessionDuration:  StringPtr("18h"),
-		AllowAuthenticateViaWarp: BoolPtr(false),
+		CreatedAt:  &createdAt,
+		UpdatedAt:  &updatedAt,
+		Name:       "Widget Corps Internal Applications",
+		AuthDomain: "test.cloudflareaccess.com",
 		LoginDesign: AccessOrganizationLoginDesign{
 			BackgroundColor: "#c5ed1b",
 			LogoPath:        "https://example.com/logo.png",
@@ -245,11 +233,9 @@ func TestUpdateAccessOrganization(t *testing.T) {
 			HeaderText:      "Widget Corp",
 			FooterText:      "© Widget Corp",
 		},
-		WarpAuthSessionDuration:  StringPtr("18h"),
-		AllowAuthenticateViaWarp: BoolPtr(false),
-		IsUIReadOnly:             BoolPtr(false),
-		SessionDuration:          StringPtr("12h"),
-		UIReadOnlyToggleReason:   "this is my reason",
+		IsUIReadOnly:           BoolPtr(false),
+		SessionDuration:        StringPtr("12h"),
+		UIReadOnlyToggleReason: "this is my reason",
 	})
 
 	if assert.NoError(t, err) {
@@ -268,11 +254,9 @@ func TestUpdateAccessOrganization(t *testing.T) {
 			HeaderText:      "Widget Corp",
 			FooterText:      "© Widget Corp",
 		},
-		WarpAuthSessionDuration:  StringPtr("18h"),
-		AllowAuthenticateViaWarp: BoolPtr(false),
-		IsUIReadOnly:             BoolPtr(false),
-		UIReadOnlyToggleReason:   "this is my reason",
-		SessionDuration:          StringPtr("12h"),
+		IsUIReadOnly:           BoolPtr(false),
+		UIReadOnlyToggleReason: "this is my reason",
+		SessionDuration:        StringPtr("12h"),
 	})
 
 	if assert.NoError(t, err) {
diff --git a/dlp_profile_test.go b/dlp_profile_test.go
index 376a7b0cd..9a12c24a6 100644
--- a/dlp_profile_test.go
+++ b/dlp_profile_test.go
@@ -45,7 +45,13 @@ func TestDLPProfiles(t *testing.T) {
 						}
 					],
 					"type": "predefined",
-					"allowed_match_count": 0
+					"allowed_match_count": 0,
+					"context_awareness": {
+						"enabled": true,
+						"skip": {
+							"files": true
+						}
+					}
 				},
 				{
 					"id": "29678c26-a191-428d-9f63-6e20a4a636a4",
@@ -69,7 +75,13 @@ func TestDLPProfiles(t *testing.T) {
 					"updated_at": "2022-10-18T08:00:57Z",
 					"type": "custom",
 					"description": "just a custom profile example",
-					"allowed_match_count": 1
+					"allowed_match_count": 1,
+					"context_awareness": {
+						"enabled": false,
+						"skip": {
+							"files": false
+						}
+					}
 				}
 			]
 		}
@@ -86,6 +98,12 @@ func TestDLPProfiles(t *testing.T) {
 			Type:              "predefined",
 			Description:       "",
 			AllowedMatchCount: 0,
+			ContextAwareness: DLPContextAwareness{
+				Enabled: BoolPtr(true),
+				Skip: DLPContextAwarenessSkip{
+					Files: BoolPtr(true),
+				},
+			},
 			Entries: []DLPEntry{
 				{
 					ID:        "111b9d4b-a5c6-40f0-957d-9d53b25dd84a",
@@ -108,6 +126,12 @@ func TestDLPProfiles(t *testing.T) {
 			Type:              "custom",
 			Description:       "just a custom profile example",
 			AllowedMatchCount: 1,
+			ContextAwareness: DLPContextAwareness{
+				Enabled: BoolPtr(false),
+				Skip: DLPContextAwarenessSkip{
+					Files: BoolPtr(false),
+				},
+			},
 			Entries: []DLPEntry{
 				{
 					ID:        "ef79b054-12d4-4067-bb30-b85f6267b91c",
@@ -167,7 +191,13 @@ func TestGetDLPProfile(t *testing.T) {
 				"updated_at": "2022-10-18T08:00:57Z",
 				"type": "custom",
 				"description": "just a custom profile example",
-				"allowed_match_count": 42
+				"allowed_match_count": 42,
+				"context_awareness": {
+					"enabled": false,
+					"skip": {
+						"files": false
+					}
+				}
 			}
 		}`)
 	}
@@ -181,6 +211,12 @@ func TestGetDLPProfile(t *testing.T) {
 		Type:              "custom",
 		Description:       "just a custom profile example",
 		AllowedMatchCount: 42,
+		ContextAwareness: DLPContextAwareness{
+			Enabled: BoolPtr(false),
+			Skip: DLPContextAwarenessSkip{
+				Files: BoolPtr(false),
+			},
+		},
 		Entries: []DLPEntry{
 			{
 				ID:        "ef79b054-12d4-4067-bb30-b85f6267b91c",
@@ -533,16 +569,29 @@ func TestUpdateDLPPredefinedProfile(t *testing.T) {
 				],
 				"type": "predefined",
 				"description": "example predefined profile",
-				"allowed_match_count": 0
+				"allowed_match_count": 0,
+				"context_awareness": {
+					"enabled": true,
+					"skip": {
+						"files": true
+					}
+				}
 			}
 		}`)
 	}
 
 	want := DLPProfile{
-		ID:          "29678c26-a191-428d-9f63-6e20a4a636a4",
-		Name:        "Example predefined profile",
-		Type:        "predefined",
-		Description: "example predefined profile",
+		ID:                "29678c26-a191-428d-9f63-6e20a4a636a4",
+		Name:              "Example predefined profile",
+		Type:              "predefined",
+		Description:       "example predefined profile",
+		AllowedMatchCount: 0,
+		ContextAwareness: DLPContextAwareness{
+			Enabled: BoolPtr(true),
+			Skip: DLPContextAwarenessSkip{
+				Files: BoolPtr(true),
+			},
+		},
 		Entries: []DLPEntry{
 			{
 				ID:        "ef79b054-12d4-4067-bb30-b85f6267b91c",
@@ -552,7 +601,6 @@ func TestUpdateDLPPredefinedProfile(t *testing.T) {
 				Enabled:   BoolPtr(true),
 			},
 		},
-		AllowedMatchCount: 0,
 	}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/dlp/profiles/predefined/29678c26-a191-428d-9f63-6e20a4a636a4", handler)
diff --git a/images_variants_test.go b/images_variants_test.go
deleted file mode 100644
index 994eaad2c..000000000
--- a/images_variants_test.go
+++ /dev/null
@@ -1,195 +0,0 @@
-package cloudflare
-
-import (
-	"context"
-	"fmt"
-	"net/http"
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-)
-
-const (
-	testImagesVariantID = "hero"
-)
-
-func TestImageVariants_List(t *testing.T) {
-	setup()
-	defer teardown()
-
-	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.Fprint(w, loadFixture("images_variants", "single_list"))
-	}
-
-	mux.HandleFunc("/accounts/"+testAccountID+"/images/v1/variants", handler)
-
-	want := ListImageVariantsResult{
-		ImagesVariants: map[string]ImagesVariant{
-			"hero": {
-				ID:                     "hero",
-				NeverRequireSignedURLs: BoolPtr(true),
-				Options: ImagesVariantsOptions{
-					Fit:      "scale-down",
-					Height:   768,
-					Width:    1366,
-					Metadata: "none",
-				},
-			},
-		},
-	}
-
-	got, err := client.ListImagesVariants(context.Background(), AccountIdentifier(testAccountID), ListImageVariantsParams{})
-	if assert.NoError(t, err) {
-		assert.Equal(t, want, got)
-	}
-}
-
-func TestImageVariants_Delete(t *testing.T) {
-	setup()
-	defer teardown()
-
-	handler := func(w http.ResponseWriter, r *http.Request) {
-		assert.Equal(t, http.MethodDelete, r.Method, "Expected method '%s', got %s", http.MethodDelete, r.Method)
-		w.Header().Set("content-type", "application/json")
-		fmt.Fprint(w, `{
-			"success": true,
-			"errors": [],
-			"messages": [],
-			"result": {}
-		}`)
-	}
-
-	url := fmt.Sprintf("/accounts/%s/images/v1/variants/%s", testAccountID, testImagesVariantID)
-	mux.HandleFunc(url, handler)
-
-	err := client.DeleteImagesVariant(context.Background(), AccountIdentifier(testAccountID), testImagesVariantID)
-	assert.NoError(t, err)
-}
-
-func TestImagesVariants_Get(t *testing.T) {
-	setup()
-	defer teardown()
-
-	handler := func(w http.ResponseWriter, r *http.Request) {
-		assert.Equal(t, http.MethodGet, r.Method, "Expected method '%s', got %s", http.MethodGet, r.Method)
-		w.Header().Set("content-type", "application/json")
-		fmt.Fprint(w, loadFixture("images_variants", "single_full"))
-	}
-
-	url := fmt.Sprintf("/accounts/%s/images/v1/variants/%s", testAccountID, testImagesVariantID)
-	mux.HandleFunc(url, handler)
-
-	want := ImagesVariant{
-		ID:                     "hero",
-		NeverRequireSignedURLs: BoolPtr(true),
-		Options: ImagesVariantsOptions{
-			Fit:      "scale-down",
-			Height:   768,
-			Width:    1366,
-			Metadata: "none",
-		},
-	}
-
-	got, err := client.GetImagesVariant(context.Background(), AccountIdentifier(testAccountID), testImagesVariantID)
-	if assert.NoError(t, err) {
-		assert.Equal(t, want, got)
-	}
-}
-
-func TestImagesVariants_Create(t *testing.T) {
-	setup()
-	defer teardown()
-
-	handler := func(w http.ResponseWriter, r *http.Request) {
-		assert.Equal(t, http.MethodPost, r.Method, "Expected method '%s', got %s", http.MethodPost, r.Method)
-		w.Header().Set("content-type", "application/json")
-		fmt.Fprint(w, loadFixture("images_variants", "single_full"))
-	}
-
-	url := fmt.Sprintf("/accounts/%s/images/v1/variants", testAccountID)
-	mux.HandleFunc(url, handler)
-
-	want := ImagesVariant{
-		ID:                     "hero",
-		NeverRequireSignedURLs: BoolPtr(true),
-		Options: ImagesVariantsOptions{
-			Fit:      "scale-down",
-			Height:   768,
-			Width:    1366,
-			Metadata: "none",
-		},
-	}
-
-	got, err := client.CreateImagesVariant(context.Background(), AccountIdentifier(testAccountID), CreateImagesVariantParams{
-		ID:                     testImagesVariantID,
-		NeverRequireSignedURLs: BoolPtr(true),
-		Options: ImagesVariantsOptions{
-			Fit:      "scale-down",
-			Height:   768,
-			Width:    1366,
-			Metadata: "none",
-		},
-	})
-	if assert.NoError(t, err) {
-		assert.Equal(t, want, got)
-	}
-}
-
-func TestImagesVariants_Update(t *testing.T) {
-	setup()
-	defer teardown()
-
-	handler := func(w http.ResponseWriter, r *http.Request) {
-		assert.Equal(t, http.MethodPatch, r.Method, "Expected method '%s', got %s", http.MethodPatch, r.Method)
-		w.Header().Set("content-type", "application/json")
-		fmt.Fprint(w, loadFixture("images_variants", "single_full"))
-	}
-
-	url := fmt.Sprintf("/accounts/%s/images/v1/variants/%s", testAccountID, testImagesVariantID)
-	mux.HandleFunc(url, handler)
-
-	want := ImagesVariant{
-		ID:                     "hero",
-		NeverRequireSignedURLs: BoolPtr(true),
-		Options: ImagesVariantsOptions{
-			Fit:      "scale-down",
-			Height:   768,
-			Width:    1366,
-			Metadata: "none",
-		},
-	}
-
-	got, err := client.UpdateImagesVariant(context.Background(), AccountIdentifier(testAccountID), UpdateImagesVariantParams{
-		ID:                     "hero",
-		NeverRequireSignedURLs: BoolPtr(true),
-		Options: ImagesVariantsOptions{
-			Fit:      "scale-down",
-			Height:   768,
-			Width:    1366,
-			Metadata: "none",
-		},
-	})
-
-	if assert.NoError(t, err) {
-		assert.Equal(t, want, got)
-	}
-}
-
-func TestImageVariants_MissingAccountId(t *testing.T) {
-	_, err := client.ListImagesVariants(context.Background(), AccountIdentifier(""), ListImageVariantsParams{})
-	assert.Equal(t, ErrMissingAccountID, err)
-
-	_, err = client.GetImagesVariant(context.Background(), AccountIdentifier(""), testImagesVariantID)
-	assert.Equal(t, ErrMissingAccountID, err)
-
-	_, err = client.CreateImagesVariant(context.Background(), AccountIdentifier(""), CreateImagesVariantParams{})
-	assert.Equal(t, ErrMissingAccountID, err)
-
-	err = client.DeleteImagesVariant(context.Background(), AccountIdentifier(""), testImagesVariantID)
-	assert.Equal(t, ErrMissingAccountID, err)
-
-	_, err = client.UpdateImagesVariant(context.Background(), AccountIdentifier(""), UpdateImagesVariantParams{})
-	assert.Equal(t, ErrMissingAccountID, err)
-}
diff --git a/testdata/fixtures/images_variants/single_full.json b/testdata/fixtures/images_variants/single_full.json
deleted file mode 100644
index f8bc039b5..000000000
--- a/testdata/fixtures/images_variants/single_full.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-  "errors": [],
-  "messages": [],
-  "result": {
-    "variant": {
-      "id": "hero",
-      "neverRequireSignedURLs": true,
-      "options": {
-        "fit": "scale-down",
-        "height": 768,
-        "metadata": "none",
-        "width": 1366
-      }
-    }
-  },
-  "success": true
-}
diff --git a/testdata/fixtures/images_variants/single_list.json b/testdata/fixtures/images_variants/single_list.json
deleted file mode 100644
index 1838aa6ce..000000000
--- a/testdata/fixtures/images_variants/single_list.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "errors": [],
-  "messages": [],
-  "result": {
-    "variants": {
-      "hero": {
-        "id": "hero",
-        "neverRequireSignedURLs": true,
-        "options": {
-          "fit": "scale-down",
-          "height": 768,
-          "metadata": "none",
-          "width": 1366
-        }
-      }
-    }
-  },
-  "success": true
-}