Skip to content

Commit fb3656e

Browse files
author
Eduardo Gomes
committed
AUTH-6690 Add more fields for access application private destinations
1 parent 1ad4079 commit fb3656e

File tree

2 files changed

+67
-8
lines changed

2 files changed

+67
-8
lines changed

access_application.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ const (
3535

3636
type AccessDestination struct {
3737
Type AccessDestinationType `json:"type"`
38-
URI string `json:"uri"`
38+
// URI is required and only used for public destinations.
39+
URI string `json:"uri,omitempty"`
40+
// Hostname can only be used for private destinations.
41+
Hostname string `json:"hostname,omitempty"`
42+
// CIDR can only be used for private destinations.
43+
CIDR string `json:"cidr,omitempty"`
44+
// PortRange can only be used for private destinations.
45+
PortRange string `json:"port_range,omitempty"`
46+
// L4Protocol can only be used for private destinations.
47+
L4Protocol string `json:"l4_protocol,omitempty"`
48+
// VnetID can only be used for private destinations.
49+
VnetID string `json:"vnet_id,omitempty"`
3950
}
4051

4152
// AccessApplication represents an Access application.

access_application_test.go

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,14 @@ func TestCreateAccessApplications(t *testing.T) {
294294
"domain_type": "public",
295295
"destinations": [
296296
{"type": "public", "uri": "test.example.com/admin"},
297-
{"type": "public", "uri": "test.example.com/admin2"}
297+
{"type": "private", "hostname": "test.private.domain"},
298+
{
299+
"type": "private",
300+
"cidr": "192.168.1.0/24",
301+
"port_range": "8080-8081",
302+
"vnet_id": "e69219cb-095a-4839-a352-b25b3d43aaac",
303+
"l4_protocol": "udp"
304+
}
298305
],
299306
"type": "self_hosted",
300307
"session_duration": "24h",
@@ -342,8 +349,21 @@ func TestCreateAccessApplications(t *testing.T) {
342349
Domain: "test.example.com/admin",
343350
DomainType: AccessDestinationPublic,
344351
Destinations: []AccessDestination{
345-
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
346-
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
352+
{
353+
Type: AccessDestinationPublic,
354+
URI: "test.example.com/admin",
355+
},
356+
{
357+
Type: AccessDestinationPrivate,
358+
Hostname: "test.private.domain",
359+
},
360+
{
361+
Type: AccessDestinationPrivate,
362+
CIDR: "192.168.1.0/24",
363+
PortRange: "8080-8081",
364+
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
365+
L4Protocol: "udp",
366+
},
347367
},
348368
Type: "self_hosted",
349369
SessionDuration: "24h",
@@ -429,7 +449,14 @@ func TestUpdateAccessApplication(t *testing.T) {
429449
"domain_type": "public",
430450
"destinations": [
431451
{"type": "public", "uri": "test.example.com/admin"},
432-
{"type": "public", "uri": "test.example.com/admin2"}
452+
{"type": "private", "hostname": "test.private.domain"},
453+
{
454+
"type": "private",
455+
"cidr": "192.168.1.0/24",
456+
"port_range": "8080-8081",
457+
"vnet_id": "e69219cb-095a-4839-a352-b25b3d43aaac",
458+
"l4_protocol": "udp"
459+
}
433460
],
434461
"type": "self_hosted",
435462
"session_duration": "24h",
@@ -476,7 +503,14 @@ func TestUpdateAccessApplication(t *testing.T) {
476503
DomainType: AccessDestinationPublic,
477504
Destinations: []AccessDestination{
478505
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
479-
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
506+
{Type: AccessDestinationPrivate, Hostname: "test.private.domain"},
507+
{
508+
Type: AccessDestinationPrivate,
509+
CIDR: "192.168.1.0/24",
510+
PortRange: "8080-8081",
511+
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
512+
L4Protocol: "udp",
513+
},
480514
},
481515
Type: "self_hosted",
482516
SessionDuration: "24h",
@@ -519,7 +553,14 @@ func TestUpdateAccessApplication(t *testing.T) {
519553
DomainType: AccessDestinationPublic,
520554
Destinations: []AccessDestination{
521555
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
522-
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
556+
{Type: AccessDestinationPrivate, Hostname: "test.private.domain"},
557+
{
558+
Type: AccessDestinationPrivate,
559+
CIDR: "192.168.1.0/24",
560+
PortRange: "8080-8081",
561+
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
562+
L4Protocol: "udp",
563+
},
523564
},
524565
Type: "self_hosted",
525566
SessionDuration: "24h",
@@ -557,7 +598,14 @@ func TestUpdateAccessApplication(t *testing.T) {
557598
DomainType: AccessDestinationPublic,
558599
Destinations: []AccessDestination{
559600
{Type: AccessDestinationPublic, URI: "test.example.com/admin"},
560-
{Type: AccessDestinationPublic, URI: "test.example.com/admin2"},
601+
{Type: AccessDestinationPrivate, Hostname: "test.private.domain"},
602+
{
603+
Type: AccessDestinationPrivate,
604+
CIDR: "192.168.1.0/24",
605+
PortRange: "8080-8081",
606+
VnetID: "e69219cb-095a-4839-a352-b25b3d43aaac",
607+
L4Protocol: "udp",
608+
},
561609
},
562610
Type: "self_hosted",
563611
SessionDuration: "24h",

0 commit comments

Comments
 (0)