Skip to content

Commit

Permalink
Merge branch 'master' into support-stream-create-params-for-tus
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbshah authored Oct 18, 2023
2 parents 54e249c + 3117cc8 commit 8f778f1
Show file tree
Hide file tree
Showing 29 changed files with 2,441 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .changelog/1406.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
api_shield_schema: Add support for managing schemas for API Shield Schema Validation 2.0
```
3 changes: 3 additions & 0 deletions .changelog/1407.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
access_application: Add support for app launcher customization fields
```
3 changes: 3 additions & 0 deletions .changelog/1413.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
api_shield_discovery: Add support for Get/Patch API Shield API Discovery Operations
```
7 changes: 7 additions & 0 deletions .changelog/1415.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
access_organization: Add support for session_duration
```

```release-note:enhancement
access_policy: Add support for session_duration
```
3 changes: 3 additions & 0 deletions .changelog/1416.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
deps: bumps golang.org/x/net from 0.15.0 to 0.16.0
```
3 changes: 3 additions & 0 deletions .changelog/1417.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
d1: adds support for d1
```
3 changes: 3 additions & 0 deletions .changelog/1418.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
api_shield_schema: Add support for Get/Update API Shield Schema Validation Settings
```
3 changes: 3 additions & 0 deletions .changelog/1419.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
teams: Add `audit_ssh_settings` endpoints
```
3 changes: 3 additions & 0 deletions .changelog/1420.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
deps: bumps golang.org/x/net from 0.16.0 to 0.17.0
```
3 changes: 3 additions & 0 deletions .changelog/1421.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
deps: bumps golang.org/x/net from 0.7.0 to 0.17.0
```
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
## 0.79.0 (Unreleased)
## 0.80.0 (Unreleased)

ENHANCEMENTS:

* access_application: Add support for app launcher customization fields ([#1407](https://github.com/cloudflare/cloudflare-go/issues/1407))
* api_shield_schema: Add support for Get/Update API Shield Schema Validation Settings ([#1418](https://github.com/cloudflare/cloudflare-go/issues/1418))

DEPENDENCIES:

* deps: bumps golang.org/x/net from 0.7.0 to 0.17.0 ([#1421](https://github.com/cloudflare/cloudflare-go/issues/1421))

## 0.79.0 (October 11th, 2023)

ENHANCEMENTS:

* access_organization: Add support for session_duration ([#1415](https://github.com/cloudflare/cloudflare-go/issues/1415))
* access_policy: Add support for session_duration ([#1415](https://github.com/cloudflare/cloudflare-go/issues/1415))

ENHANCEMENTS:

* api_shield_discovery: Add support for Get/Patch API Shield API Discovery Operations ([#1413](https://github.com/cloudflare/cloudflare-go/issues/1413))
* api_shield_schema: Add support for managing schemas for API Shield Schema Validation 2.0 ([#1406](https://github.com/cloudflare/cloudflare-go/issues/1406))
* d1: adds support for d1 ([#1417](https://github.com/cloudflare/cloudflare-go/issues/1417))
* teams: Add `audit_ssh_settings` endpoints ([#1419](https://github.com/cloudflare/cloudflare-go/issues/1419))

BUG FIXES:

* custom_nameservers: change `NSSet` from string to int to match API response ([#1410](https://github.com/cloudflare/cloudflare-go/issues/1410))
* observatory: fix double url encoding ([#1412](https://github.com/cloudflare/cloudflare-go/issues/1412))

DEPENDENCIES:

* deps: bumps golang.org/x/net from 0.15.0 to 0.16.0 ([#1416](https://github.com/cloudflare/cloudflare-go/issues/1416))
* deps: bumps golang.org/x/net from 0.16.0 to 0.17.0 ([#1420](https://github.com/cloudflare/cloudflare-go/issues/1420))

## 0.78.0 (September 27th, 2023)

BREAKING CHANGES:
Expand Down
23 changes: 23 additions & 0 deletions access_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type AccessApplication struct {
PathCookieAttribute *bool `json:"path_cookie_attribute,omitempty"`
CustomPages []string `json:"custom_pages,omitempty"`
Tags []string `json:"tags,omitempty"`
AccessAppLauncherCustomization
}

type AccessApplicationGatewayRule struct {
Expand Down Expand Up @@ -116,6 +117,26 @@ type SaasApplication struct {
CustomAttributes []SAMLAttributeConfig `json:"custom_attributes,omitempty"`
}

type AccessAppLauncherCustomization struct {
LandingPageDesign AccessLandingPageDesign `json:"landing_page_design"`
LogoURL string `json:"app_launcher_logo_url"`
HeaderBackgroundColor string `json:"header_bg_color"`
BackgroundColor string `json:"bg_color"`
FooterLinks []AccessFooterLink `json:"footer_links"`
}

type AccessFooterLink struct {
Name string `json:"name"`
URL string `json:"url"`
}

type AccessLandingPageDesign struct {
Title string `json:"title"`
Message string `json:"message"`
ImageURL string `json:"image_url"`
ButtonColor string `json:"button_color"`
ButtonTextColor string `json:"button_text_color"`
}
type ListAccessApplicationsParams struct {
ResultInfo
}
Expand Down Expand Up @@ -146,6 +167,7 @@ type CreateAccessApplicationParams struct {
Type AccessApplicationType `json:"type,omitempty"`
CustomPages []string `json:"custom_pages,omitempty"`
Tags []string `json:"tags,omitempty"`
AccessAppLauncherCustomization
}

type UpdateAccessApplicationParams struct {
Expand Down Expand Up @@ -175,6 +197,7 @@ type UpdateAccessApplicationParams struct {
Type AccessApplicationType `json:"type,omitempty"`
CustomPages []string `json:"custom_pages,omitempty"`
Tags []string `json:"tags,omitempty"`
AccessAppLauncherCustomization
}

// ListAccessApplications returns all applications within an account or zone.
Expand Down
114 changes: 114 additions & 0 deletions access_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,3 +759,117 @@ func TestCreateSaasAccessApplications(t *testing.T) {
assert.Equal(t, fullAccessApplication, actual)
}
}

func TestCreateApplicationWithAccessAppLauncherCustomization(t *testing.T) {
setup()
defer teardown()

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
w.Header().Set("content-type", "application/json")
fmt.Fprintf(w, `{
"success": true,
"errors": [],
"messages": [],
"result": {
"id": "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
"created_at": "2014-01-01T05:20:00.12345Z",
"updated_at": "2014-01-01T05:20:00.12345Z",
"aud": "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893",
"name": "App Launcher",
"type": "app_launcher",
"session_duration": "24h",
"auto_redirect_to_identity": false,
"enable_binding_cookie": false,
"custom_deny_url": "https://www.example.com",
"custom_deny_message": "denied!",
"logo_url": "https://www.example.com/example.png",
"skip_interstitial": true,
"app_launcher_visible": false,
"service_auth_401_redirect": false,
"landing_page_design": {
"title": "A title",
"message": "a message",
"image_url": "https://www.example.com/example.png",
"button_color": "green",
"button_text_color": "red"
},
"header_bg_color": "red",
"bg_color": "blue",
"footer_links": [
{
"url": "https://somesite.com",
"name": "bug"
}
]
}
}
`)
}

createdAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
fullAccessApplication := AccessApplication{
ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
Name: "App Launcher",
Type: "app_launcher",
SessionDuration: "24h",
AUD: "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893",
AutoRedirectToIdentity: BoolPtr(false),
EnableBindingCookie: BoolPtr(false),
AppLauncherVisible: BoolPtr(false),
ServiceAuth401Redirect: BoolPtr(false),
CustomDenyMessage: "denied!",
CustomDenyURL: "https://www.example.com",
LogoURL: "https://www.example.com/example.png",
SkipInterstitial: BoolPtr(true),
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
AccessAppLauncherCustomization: AccessAppLauncherCustomization{
LandingPageDesign: AccessLandingPageDesign{
Title: "A title",
Message: "a message",
ImageURL: "https://www.example.com/example.png",
ButtonColor: "green",
ButtonTextColor: "red",
},
HeaderBackgroundColor: "red",
BackgroundColor: "blue",
FooterLinks: []AccessFooterLink{
{
URL: "https://somesite.com",
Name: "bug",
},
},
},
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/apps", handler)

actual, err := client.CreateAccessApplication(context.Background(), AccountIdentifier(testAccountID), CreateAccessApplicationParams{
Name: "Admin Site",
SessionDuration: "24h",
Type: "app_launcher",
AccessAppLauncherCustomization: AccessAppLauncherCustomization{
LandingPageDesign: AccessLandingPageDesign{
Title: "A title",
Message: "a message",
ImageURL: "https://www.example.com/example.png",
ButtonColor: "green",
ButtonTextColor: "red",
},
HeaderBackgroundColor: "red",
BackgroundColor: "blue",
FooterLinks: []AccessFooterLink{
{
URL: "https://somesite.com",
Name: "bug",
},
},
},
})

if assert.NoError(t, err) {
assert.Equal(t, fullAccessApplication, actual)
}
}
3 changes: 3 additions & 0 deletions access_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type AccessOrganization struct {
UIReadOnlyToggleReason string `json:"ui_read_only_toggle_reason,omitempty"`
UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time,omitempty"`
AutoRedirectToIdentity *bool `json:"auto_redirect_to_identity,omitempty"`
SessionDuration *string `json:"session_duration,omitempty"`
CustomPages AccessOrganizationCustomPages `json:"custom_pages,omitempty"`
}

Expand Down Expand Up @@ -64,6 +65,7 @@ type CreateAccessOrganizationParams struct {
UIReadOnlyToggleReason string `json:"ui_read_only_toggle_reason,omitempty"`
UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time,omitempty"`
AutoRedirectToIdentity *bool `json:"auto_redirect_to_identity,omitempty"`
SessionDuration *string `json:"session_duration,omitempty"`
CustomPages AccessOrganizationCustomPages `json:"custom_pages,omitempty"`
}

Expand All @@ -75,6 +77,7 @@ type UpdateAccessOrganizationParams struct {
UIReadOnlyToggleReason string `json:"ui_read_only_toggle_reason,omitempty"`
UserSeatExpirationInactiveTime string `json:"user_seat_expiration_inactive_time,omitempty"`
AutoRedirectToIdentity *bool `json:"auto_redirect_to_identity,omitempty"`
SessionDuration *string `json:"session_duration,omitempty"`
CustomPages AccessOrganizationCustomPages `json:"custom_pages,omitempty"`
}

Expand Down
18 changes: 14 additions & 4 deletions access_organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestAccessOrganization(t *testing.T) {
"is_ui_read_only": false,
"user_seat_expiration_inactive_time": "720h",
"auto_redirect_to_identity": true,
"session_duration": "12h",
"login_design": {
"background_color": "#c5ed1b",
"logo_path": "https://example.com/logo.png",
Expand Down Expand Up @@ -57,6 +58,7 @@ func TestAccessOrganization(t *testing.T) {
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(false),
SessionDuration: StringPtr("12h"),
UserSeatExpirationInactiveTime: "720h",
AutoRedirectToIdentity: BoolPtr(true),
}
Expand Down Expand Up @@ -95,6 +97,7 @@ func TestCreateAccessOrganization(t *testing.T) {
"name": "Widget Corps Internal Applications",
"auth_domain": "test.cloudflareaccess.com",
"is_ui_read_only": true,
"session_duration": "12h",
"login_design": {
"background_color": "#c5ed1b",
"logo_path": "https://example.com/logo.png",
Expand Down Expand Up @@ -122,7 +125,8 @@ func TestCreateAccessOrganization(t *testing.T) {
HeaderText: "Widget Corp",
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(true),
IsUIReadOnly: BoolPtr(true),
SessionDuration: StringPtr("12h"),
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler)
Expand All @@ -137,7 +141,8 @@ func TestCreateAccessOrganization(t *testing.T) {
HeaderText: "Widget Corp",
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(true),
IsUIReadOnly: BoolPtr(true),
SessionDuration: StringPtr("12h"),
})

if assert.NoError(t, err) {
Expand All @@ -156,7 +161,8 @@ func TestCreateAccessOrganization(t *testing.T) {
HeaderText: "Widget Corp",
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(true),
IsUIReadOnly: BoolPtr(true),
SessionDuration: StringPtr("12h"),
})

if assert.NoError(t, err) {
Expand Down Expand Up @@ -188,7 +194,8 @@ func TestUpdateAccessOrganization(t *testing.T) {
"footer_text": "© Widget Corp"
},
"is_ui_read_only": false,
"ui_read_only_toggle_reason": "this is my reason"
"ui_read_only_toggle_reason": "this is my reason",
"session_duration": "12h"
}
}
`)
Expand All @@ -211,6 +218,7 @@ func TestUpdateAccessOrganization(t *testing.T) {
},
IsUIReadOnly: BoolPtr(false),
UIReadOnlyToggleReason: "this is my reason",
SessionDuration: StringPtr("12h"),
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler)
Expand All @@ -226,6 +234,7 @@ func TestUpdateAccessOrganization(t *testing.T) {
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(false),
SessionDuration: StringPtr("12h"),
UIReadOnlyToggleReason: "this is my reason",
})

Expand All @@ -247,6 +256,7 @@ func TestUpdateAccessOrganization(t *testing.T) {
},
IsUIReadOnly: BoolPtr(false),
UIReadOnlyToggleReason: "this is my reason",
SessionDuration: StringPtr("12h"),
})

if assert.NoError(t, err) {
Expand Down
3 changes: 3 additions & 0 deletions access_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type AccessPolicy struct {
Name string `json:"name"`

IsolationRequired *bool `json:"isolation_required,omitempty"`
SessionDuration *string `json:"session_duration,omitempty"`
PurposeJustificationRequired *bool `json:"purpose_justification_required,omitempty"`
PurposeJustificationPrompt *string `json:"purpose_justification_prompt,omitempty"`
ApprovalRequired *bool `json:"approval_required,omitempty"`
Expand Down Expand Up @@ -84,6 +85,7 @@ type CreateAccessPolicyParams struct {
Name string `json:"name"`

IsolationRequired *bool `json:"isolation_required,omitempty"`
SessionDuration *string `json:"session_duration,omitempty"`
PurposeJustificationRequired *bool `json:"purpose_justification_required,omitempty"`
PurposeJustificationPrompt *string `json:"purpose_justification_prompt,omitempty"`
ApprovalRequired *bool `json:"approval_required,omitempty"`
Expand Down Expand Up @@ -111,6 +113,7 @@ type UpdateAccessPolicyParams struct {
Name string `json:"name"`

IsolationRequired *bool `json:"isolation_required,omitempty"`
SessionDuration *string `json:"session_duration,omitempty"`
PurposeJustificationRequired *bool `json:"purpose_justification_required,omitempty"`
PurposeJustificationPrompt *string `json:"purpose_justification_prompt,omitempty"`
ApprovalRequired *bool `json:"approval_required,omitempty"`
Expand Down
Loading

0 comments on commit 8f778f1

Please sign in to comment.