diff --git a/README.md b/README.md index a47af860..e9ddf30b 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ ## Introduction -> Version: **2409.1.9** +> Version: **2409.1.11** > -> Date: **September 27, 2024** +> Date: **October 17, 2024** --- @@ -14,7 +14,7 @@ * [Mist Automation Guide](https://www.juniper.net/documentation/us/en/software/mist/automation-integration/index.html) * [Mist Location SDK](https://www.juniper.net/documentation/us/en/software/mist/location_services/topics/concept/mist-how-get-mist-sdk.html) -* [Mist Product Updates](https://www.mist.com/documentation/category/product-updates/) +* [Mist Product Updates](https://www.juniper.net/documentation/us/en/software/mist/product-updates/) --- @@ -234,6 +234,7 @@ This API uses the following authentication schemes. * [Orgs Stats-Mx Edges](doc/controllers/orgs-stats-mx-edges.md) * [Orgs Stats-Other Devices](doc/controllers/orgs-stats-other-devices.md) * [Orgs Stats-Ports](doc/controllers/orgs-stats-ports.md) +* [Orgs Stats-Sites](doc/controllers/orgs-stats-sites.md) * [Orgs Stats-Tunnels](doc/controllers/orgs-stats-tunnels.md) * [Orgs Stats-VPN Peers](doc/controllers/orgs-stats-vpn-peers.md) * [Orgs Subscriptions](doc/controllers/orgs-subscriptions.md) diff --git a/doc/client.md b/doc/client.md index d0ad43c5..298d829e 100644 --- a/doc/client.md +++ b/doc/client.md @@ -128,6 +128,7 @@ The gateway for the SDK. This class acts as a factory for the Controllers and al | OrgsStatsMxEdges() | Gets OrgsStatsMxEdges | | OrgsStatsOtherDevices() | Gets OrgsStatsOtherDevices | | OrgsStatsPorts() | Gets OrgsStatsPorts | +| OrgsStatsSites() | Gets OrgsStatsSites | | OrgsStatsTunnels() | Gets OrgsStatsTunnels | | OrgsStatsVPNPeers() | Gets OrgsStatsVPNPeers | | OrgsNACRules() | Gets OrgsNACRules | diff --git a/doc/controllers/orgs-clients-wired.md b/doc/controllers/orgs-clients-wired.md index 514f6b6d..32f748ab 100644 --- a/doc/controllers/orgs-clients-wired.md +++ b/doc/controllers/orgs-clients-wired.md @@ -123,7 +123,7 @@ SearchOrgWiredClients( mac *string, portId *string, vlan *int, - ip *string, + ipAddress *string, manufacture *string, text *string, nacruleId *string, @@ -146,13 +146,13 @@ SearchOrgWiredClients( | --- | --- | --- | --- | | `orgId` | `uuid.UUID` | Template, Required | - | | `siteId` | `*string` | Query, Optional | Site ID | -| `deviceMac` | `*string` | Query, Optional | device mac | -| `mac` | `*string` | Query, Optional | client mac | -| `portId` | `*string` | Query, Optional | port id | +| `deviceMac` | `*string` | Query, Optional | device mac (Gateway/Switch) where the client has connected to | +| `mac` | `*string` | Query, Optional | partial / full MAC address | +| `portId` | `*string` | Query, Optional | port id where the client has connected to | | `vlan` | `*int` | Query, Optional | vlan | -| `ip` | `*string` | Query, Optional | ip | +| `ipAddress` | `*string` | Query, Optional | - | | `manufacture` | `*string` | Query, Optional | client manufacturer | -| `text` | `*string` | Query, Optional | single entry of hostname/mac | +| `text` | `*string` | Query, Optional | partial / full MAC address, hostname or username | | `nacruleId` | `*string` | Query, Optional | nacrule_id | | `dhcpHostname` | `*string` | Query, Optional | DHCP Hostname | | `dhcpFqdn` | `*string` | Query, Optional | DHCP FQDN | @@ -185,7 +185,7 @@ orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") - +ipAddress := "192.168.1.1" @@ -211,7 +211,7 @@ limit := 100 duration := "10m" -apiResponse, err := orgsClientsWired.SearchOrgWiredClients(ctx, orgId, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, &limit, nil, nil, &duration) +apiResponse, err := orgsClientsWired.SearchOrgWiredClients(ctx, orgId, nil, nil, nil, nil, nil, &ipAddress, nil, nil, nil, nil, nil, nil, nil, nil, &limit, nil, nil, &duration) if err != nil { log.Fatalln(err) } else { diff --git a/doc/controllers/orgs-clients-wireless.md b/doc/controllers/orgs-clients-wireless.md index c6b362eb..61a7d6e2 100644 --- a/doc/controllers/orgs-clients-wireless.md +++ b/doc/controllers/orgs-clients-wireless.md @@ -545,12 +545,14 @@ SearchOrgWirelessClients( mac *string, ipAddress *string, hostname *string, + band *string, device *string, os *string, model *string, ap *string, pskId *string, pskName *string, + username *string, vlan *string, ssid *string, text *string, @@ -571,12 +573,14 @@ SearchOrgWirelessClients( | `mac` | `*string` | Query, Optional | partial / full MAC address | | `ipAddress` | `*string` | Query, Optional | - | | `hostname` | `*string` | Query, Optional | partial / full hostname | +| `band` | `*string` | Query, Optional | Radio band. enum: `24`, `5`, `6` | | `device` | `*string` | Query, Optional | device type, e.g. Mac, Nvidia, iPhone | -| `os` | `*string` | Query, Optional | os, e.g. Sierra, Yosemite, Windows 10 | -| `model` | `*string` | Query, Optional | model, e.g. “MBP 15 late 2013”, 6, 6s, “8+ GSM” | +| `os` | `*string` | Query, Optional | only available for clients running the Marvis Client app, os, e.g. Sierra, Yosemite, Windows 10 | +| `model` | `*string` | Query, Optional | only available for clients running the Marvis Client app, model, e.g. “MBP 15 late 2013”, 6, 6s, “8+ GSM” | | `ap` | `*string` | Query, Optional | AP mac where the client has connected to | | `pskId` | `*string` | Query, Optional | PSK ID | -| `pskName` | `*string` | Query, Optional | PSK Name | +| `pskName` | `*string` | Query, Optional | only available for clients using PPSK authentication, the Name of the PSK | +| `username` | `*string` | Query, Optional | only available for clients using 802.1X authentication, partial / full username | | `vlan` | `*string` | Query, Optional | vlan | | `ssid` | `*string` | Query, Optional | SSID | | `text` | `*string` | Query, Optional | partial / full MAC address, hostname, username, psk_name or ip | @@ -612,6 +616,8 @@ ipAddress := "192.168.1.1" + + pskId := "000000ab-00ab-00ab-00ab-0000000000ab" @@ -622,6 +628,8 @@ pskId := "000000ab-00ab-00ab-00ab-0000000000ab" + + limit := 100 @@ -630,7 +638,7 @@ limit := 100 duration := "10m" -apiResponse, err := orgsClientsWireless.SearchOrgWirelessClients(ctx, orgId, nil, nil, &ipAddress, nil, nil, nil, nil, nil, &pskId, nil, nil, nil, nil, &limit, nil, nil, &duration) +apiResponse, err := orgsClientsWireless.SearchOrgWirelessClients(ctx, orgId, nil, nil, &ipAddress, nil, nil, nil, nil, nil, nil, &pskId, nil, nil, nil, nil, nil, &limit, nil, nil, &duration) if err != nil { log.Fatalln(err) } else { @@ -671,7 +679,7 @@ if err != nil { "192.168.0.2" ], "last_ap": "a83a79a947ee", - "last_devuce": "Mac", + "last_device": "Mac", "last_firmware": "wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675", "last_hostname": "hostname-a", "last_ip": "10.5.23.43", diff --git a/doc/controllers/orgs-guests.md b/doc/controllers/orgs-guests.md index 9f867133..551897d8 100644 --- a/doc/controllers/orgs-guests.md +++ b/doc/controllers/orgs-guests.md @@ -429,7 +429,7 @@ UpdateOrgGuestAuthorization( ctx context.Context, orgId uuid.UUID, guestMac string, - body *models.Guest) ( + body *models.GuestOrg) ( models.ApiResponse[models.Guest], error) ``` @@ -440,7 +440,7 @@ UpdateOrgGuestAuthorization( | --- | --- | --- | --- | | `orgId` | `uuid.UUID` | Template, Required | - | | `guestMac` | `string` | Template, Required | **Constraints**: *Pattern*: `^[0-9a-fA-F]{12}$` | -| `body` | [`*models.Guest`](../../doc/models/guest.md) | Body, Optional | - | +| `body` | [`*models.GuestOrg`](../../doc/models/guest-org.md) | Body, Optional | - | ## Response Type @@ -455,17 +455,16 @@ orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") guestMac := "0000000000ab" -body := models.Guest{ +body := models.GuestOrg{ Authorized: models.ToPointer(true), - Company: models.ToPointer("string"), - Email: models.ToPointer("user@example.com"), - Field1: models.ToPointer("string"), - Field2: models.ToPointer("string"), - Field3: models.ToPointer("string"), - Field4: models.ToPointer("string"), - Mac: models.ToPointer("string"), - Minutes: models.ToPointer(0), - Name: models.ToPointer("string"), + AuthorizedExpiringTime: models.ToPointer(float64(1480704955)), + AuthorizedTime: models.ToPointer(float64(1480704355)), + Company: models.ToPointer("abc"), + Email: models.ToPointer("john@abc.com"), + Minutes: models.ToPointer(1440), + Name: models.ToPointer("John Smith"), + Ssid: models.ToPointer("Guest-SSID"), + WlanId: uuid.MustParse("6748cfa6-4e12-11e6-9188-0242ac110007"), } apiResponse, err := orgsGuests.UpdateOrgGuestAuthorization(ctx, orgId, guestMac, &body) diff --git a/doc/controllers/orgs-stats-sites.md b/doc/controllers/orgs-stats-sites.md new file mode 100644 index 00000000..4c19b73c --- /dev/null +++ b/doc/controllers/orgs-stats-sites.md @@ -0,0 +1,129 @@ +# Orgs Stats-Sites + +```go +orgsStatsSites := client.OrgsStatsSites() +``` + +## Class Name + +`OrgsStatsSites` + + +# List Org Site Stats + +Get List of Org Site Stats + +```go +ListOrgSiteStats( + ctx context.Context, + orgId uuid.UUID, + start *int, + end *int, + duration *string, + limit *int, + page *int) ( + models.ApiResponse[[]models.StatsSite], + error) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `orgId` | `uuid.UUID` | Template, Required | - | +| `start` | `*int` | Query, Optional | start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified | +| `end` | `*int` | Query, Optional | end datetime, can be epoch or relative time like -1d, -2h; now if not specified | +| `duration` | `*string` | Query, Optional | duration like 7d, 2w
**Default**: `"1d"` | +| `limit` | `*int` | Query, Optional | **Default**: `100`
**Constraints**: `>= 0` | +| `page` | `*int` | Query, Optional | **Default**: `1`
**Constraints**: `>= 1` | + +## Response Type + +[`[]models.StatsSite`](../../doc/models/stats-site.md) + +## Example Usage + +```go +ctx := context.Background() + +orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") + + + + + +duration := "10m" + +limit := 100 + +page := 1 + +apiResponse, err := orgsStatsSites.ListOrgSiteStats(ctx, orgId, nil, nil, &duration, &limit, &page) +if err != nil { + log.Fatalln(err) +} else { + // Printing the result and response + fmt.Println(apiResponse.Data) + fmt.Println(apiResponse.Response.StatusCode) +} +``` + +## Example Response *(as JSON)* + +```json +[ + { + "address": "1601 S De Anza Blvd, Cupertino, CA 95014, USA", + "alarmtemplate_id": null, + "analyticEnabled": true, + "aptemplate_id": null, + "country_code": "US", + "created_time": 1472591606, + "engagementEnabled": true, + "gatewaytemplate_id": "e571f2a2-d748-4ad4-bd6c-895467957c21", + "id": "83bc290a-b76d-47fa-a294-d34e47f30f7f", + "lat": 37.295553, + "latlng": { + "lat": 37.295553, + "lng": -122.033007 + }, + "lng": -122.033007, + "modified_time": 1728057857, + "msp_id": "a9af4951-a1de-4520-b398-c95a58947349", + "name": "Live-Demo", + "networktemplate_id": "964cb213-deb2-469d-8c1e-a5f8661c6886", + "notes": "This site is used for demonstration purposes.", + "num_ap": 17, + "num_ap_connected": 14, + "num_clients": 14, + "num_devices": 26, + "num_devices_connected": 22, + "num_gateway": 1, + "num_gateway_connected": 1, + "num_switch": 8, + "num_switch_connected": 7, + "org_id": "b9814b40-ac4b-4424-86a8-b787eb68b86a", + "rftemplate_id": "2c134c07-3c57-46b3-a53b-8aea92ed7234", + "secpolicy_id": null, + "sitegroup_ids": [ + "5644a432-eea9-4a2f-a30a-ddaf4dbc79cf", + "5fc0f305-f626-49db-8869-10b87f201bba", + "882796ef-190b-405e-98ef-cb487140cf64" + ], + "sitetemplate_id": null, + "timezone": "America/Los_Angeles", + "tzoffset": 960 + } +] +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 400 | Bad Syntax | [`ResponseHttp400Exception`](../../doc/models/response-http-400-exception.md) | +| 401 | Unauthorized | [`ResponseHttp401ErrorException`](../../doc/models/response-http-401-error-exception.md) | +| 403 | Permission Denied | [`ResponseHttp403ErrorException`](../../doc/models/response-http-403-error-exception.md) | +| 404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | [`ResponseHttp404Exception`](../../doc/models/response-http-404-exception.md) | +| 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | + diff --git a/doc/controllers/samples-webhooks.md b/doc/controllers/samples-webhooks.md index b6d90a5e..bd640141 100644 --- a/doc/controllers/samples-webhooks.md +++ b/doc/controllers/samples-webhooks.md @@ -217,7 +217,7 @@ if err != nil { # Client Info -Webhook sample for `client_info` topic +Webhook sample for `client-info` topic **Note**: The server host will be your own server FQDN where the Mist Cloud is sending the webhook messages @@ -247,10 +247,12 @@ ctx := context.Background() body := models.WebhookClientInfo{ Events: []models.WebhookClientInfoEvent{ models.WebhookClientInfoEvent{ - Mac: models.ToPointer("string"), - OrgId: models.ToPointer(uuid.MustParse("a40f5d1f-d889-42e9-94ea-b9b33585fc6b")), - SiteId: models.ToPointer(uuid.MustParse("72771e6a-6f5e-4de4-a5b9-1266c4197811")), - Timestamp: models.ToPointer(float64(0)), + Hostname: models.ToPointer("service.company.net"), + Ip: models.ToPointer("21.0.128.151"), + Mac: models.ToPointer("6ebaa47a3fd4"), + OrgId: models.ToPointer(uuid.MustParse("0c160b7f-1027-4cd1-923b-744534c4b070")), + SiteId: models.ToPointer(uuid.MustParse("6e77a2ea-d579-471c-9056-5ff5b4ed70ed")), + Timestamp: models.ToPointer(float64(1703003296)), }, }, Topic: models.ToPointer(models.WebhookClientInfoTopicEnum("client-info")), diff --git a/doc/controllers/sites-clients-wireless.md b/doc/controllers/sites-clients-wireless.md index 65048b54..5428a517 100644 --- a/doc/controllers/sites-clients-wireless.md +++ b/doc/controllers/sites-clients-wireless.md @@ -899,7 +899,7 @@ if err != nil { "192.168.0.2" ], "last_ap": "a83a79a947ee", - "last_devuce": "Mac", + "last_device": "Mac", "last_firmware": "wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675", "last_hostname": "hostname-a", "last_ip": "10.5.23.43", diff --git a/doc/controllers/sites-guests.md b/doc/controllers/sites-guests.md index e0de1507..9e7e4c17 100644 --- a/doc/controllers/sites-guests.md +++ b/doc/controllers/sites-guests.md @@ -540,10 +540,12 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") guestMac := "0000000000ab" body := models.Guest{ + Authorized: models.ToPointer(true), AuthorizedExpiringTime: models.ToPointer(float64(1480704955)), AuthorizedTime: models.ToPointer(float64(1480704355)), Company: models.ToPointer("abc"), Email: models.ToPointer("john@abc.com"), + Minutes: models.ToPointer(1440), Name: models.ToPointer("John Smith"), Ssid: models.ToPointer("Guest-SSID"), WlanId: models.ToPointer(uuid.MustParse("6748cfa6-4e12-11e6-9188-0242ac110007")), diff --git a/doc/controllers/sites-stats-wx-rules.md b/doc/controllers/sites-stats-wx-rules.md index e4cc2da7..102056fb 100644 --- a/doc/controllers/sites-stats-wx-rules.md +++ b/doc/controllers/sites-stats-wx-rules.md @@ -17,7 +17,7 @@ Get Wxlan Rule usage GetSiteWxRulesUsage( ctx context.Context, siteId uuid.UUID) ( - models.ApiResponse[[]models.StatsWrule], + models.ApiResponse[[]models.StatsWxrule], error) ``` @@ -29,7 +29,7 @@ GetSiteWxRulesUsage( ## Response Type -[`[]models.StatsWrule`](../../doc/models/stats-wrule.md) +[`[]models.StatsWxrule`](../../doc/models/stats-wxrule.md) ## Example Usage diff --git a/doc/controllers/utilities-common.md b/doc/controllers/utilities-common.md index c98ad7c4..445a907b 100644 --- a/doc/controllers/utilities-common.md +++ b/doc/controllers/utilities-common.md @@ -14,12 +14,7 @@ utilitiesCommon := client.UtilitiesCommon() * [Clear Site Device Mac Table](../../doc/controllers/utilities-common.md#clear-site-device-mac-table) * [Clear Site Device Policy Hit Count](../../doc/controllers/utilities-common.md#clear-site-device-policy-hit-count) * [Create Site Device Shell Session](../../doc/controllers/utilities-common.md#create-site-device-shell-session) -* [Get Site Device Arp Table](../../doc/controllers/utilities-common.md#get-site-device-arp-table) -* [Get Site Device Bgp Summary](../../doc/controllers/utilities-common.md#get-site-device-bgp-summary) * [Get Site Device Config Cmd](../../doc/controllers/utilities-common.md#get-site-device-config-cmd) -* [Get Site Device Evpn Database](../../doc/controllers/utilities-common.md#get-site-device-evpn-database) -* [Get Site Device Forwarding Table](../../doc/controllers/utilities-common.md#get-site-device-forwarding-table) -* [Get Site Device Mac Table](../../doc/controllers/utilities-common.md#get-site-device-mac-table) * [Get Site Device Ztp Password](../../doc/controllers/utilities-common.md#get-site-device-ztp-password) * [Monitor Site Device Traffic](../../doc/controllers/utilities-common.md#monitor-site-device-traffic) * [Ping From Device](../../doc/controllers/utilities-common.md#ping-from-device) @@ -27,7 +22,12 @@ utilitiesCommon := client.UtilitiesCommon() * [Release Site Device Dhcp Lease](../../doc/controllers/utilities-common.md#release-site-device-dhcp-lease) * [Reprovision Site Octerm Device](../../doc/controllers/utilities-common.md#reprovision-site-octerm-device) * [Restart Site Device](../../doc/controllers/utilities-common.md#restart-site-device) +* [Show Site Device Arp Table](../../doc/controllers/utilities-common.md#show-site-device-arp-table) +* [Show Site Device Bgp Summary](../../doc/controllers/utilities-common.md#show-site-device-bgp-summary) * [Show Site Device Dhcp Leases](../../doc/controllers/utilities-common.md#show-site-device-dhcp-leases) +* [Show Site Device Evpn Database](../../doc/controllers/utilities-common.md#show-site-device-evpn-database) +* [Show Site Device Forwarding Table](../../doc/controllers/utilities-common.md#show-site-device-forwarding-table) +* [Show Site Device Mac Table](../../doc/controllers/utilities-common.md#show-site-device-mac-table) * [Start Site Locate Device](../../doc/controllers/utilities-common.md#start-site-locate-device) * [Stop Site Locate Device](../../doc/controllers/utilities-common.md#stop-site-locate-device) * [Traceroute From Device](../../doc/controllers/utilities-common.md#traceroute-from-device) @@ -300,29 +300,20 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Arp Table +# Get Site Device Config Cmd -Get ARP Table from the Device. - -The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. - -#### Subscribe to Device Command outputs - -`WS /api-ws/v1/stream` +Get Config CLI Commands +For a brown-field switch deployment where we adopted the switch through Adoption Command, we do not wipe out / overwrite the existing config automatically. Instead, we generate CLI commands that we would have generated. The user can inspect, modify, and incorporate this into their existing config manually. -```json -{ - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -} -``` +Once they feel comfortable about the config we generate, they can enable allow_mist_config where we will take full control of their config like a claimed switch ```go -GetSiteDeviceArpTable( +GetSiteDeviceConfigCmd( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowArp) ( - models.ApiResponse[models.WebsocketSession], + sort *bool) ( + models.ApiResponse[models.ResponseDeviceConfigCli], error) ``` @@ -332,11 +323,11 @@ GetSiteDeviceArpTable( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowArp`](../../doc/models/utils-show-arp.md) | Body, Optional | all attributes are optional | +| `sort` | `*bool` | Query, Optional | Make output cmds sorted (for better readability) or not.
**Default**: `false` | ## Response Type -[`models.WebsocketSession`](../../doc/models/websocket-session.md) +[`models.ResponseDeviceConfigCli`](../../doc/models/response-device-config-cli.md) ## Example Usage @@ -347,15 +338,9 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowArp{ - Duration: models.ToPointer(0), - Interval: models.ToPointer(0), - Ip: models.ToPointer("192.168.30.7"), - PortId: models.ToPointer("ge-0/0/0.0"), - Vrf: models.ToPointer("guest"), -} +sort := false -apiResponse, err := utilitiesCommon.GetSiteDeviceArpTable(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesCommon.GetSiteDeviceConfigCmd(ctx, siteId, deviceId, &sort) if err != nil { log.Fatalln(err) } else { @@ -365,6 +350,16 @@ if err != nil { } ``` +## Example Response *(as JSON)* + +```json +{ + "cli": [ + "set system hostname corp-a135" + ] +} +``` + ## Errors | HTTP Status Code | Error Description | Exception Class | @@ -376,48 +371,16 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Bgp Summary +# Get Site Device Ztp Password -Get BGP Summary from SSR, SRX and Switch. - -The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. - -#### Subscribe to Device Command outputs - -`WS /api-ws/v1/stream` - -```json -{ - \"subscribe\": \"/sites/{site_id}/devices/{device_id}/cmd\"\ - -} -``` - -##### Example output from ws stream - -``` -Tue 2024-04-23 16:36:06 UTC -Retrieving bgp entries... -BGP table version is 354, local router ID is 10.224.8.16, vrf id 0 -Default local pref 100, local AS 65000 -Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, - i internal, r RIB_failure, S Stale, R Removed -Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self -Origin codes: i - IGP, e - EGP, ? - incomplete -RPKI validation codes: V valid, I invalid, N Not found - - Network Next Hop Metric LocPrf Weight Path -*> 161.161.161.0/24 -```" -``` +In the case where soemthing happens during/after ZTP, the root-password is modified (required for ZTP to set up outbound-ssh) but the user-defined password config has not be configured. This API can be used to retrieve the temporary password. ```go -GetSiteDeviceBgpSummary( +GetSiteDeviceZtpPassword( ctx context.Context, siteId uuid.UUID, - deviceId uuid.UUID, - body *models.UtilsShowBgpRummary) ( - models.ApiResponse[models.WebsocketSession], + deviceId uuid.UUID) ( + models.ApiResponse[models.RootPasswordString], error) ``` @@ -427,11 +390,10 @@ GetSiteDeviceBgpSummary( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowBgpRummary`](../../doc/models/utils-show-bgp-rummary.md) | Body, Optional | all attributes are optional | ## Response Type -[`models.WebsocketSession`](../../doc/models/websocket-session.md) +[`models.RootPasswordString`](../../doc/models/root-password-string.md) ## Example Usage @@ -442,9 +404,7 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") - - -apiResponse, err := utilitiesCommon.GetSiteDeviceBgpSummary(ctx, siteId, deviceId, nil) +apiResponse, err := utilitiesCommon.GetSiteDeviceZtpPassword(ctx, siteId, deviceId) if err != nil { log.Fatalln(err) } else { @@ -454,6 +414,14 @@ if err != nil { } ``` +## Example Response *(as JSON)* + +```json +{ + "root_password": "ef8070ef8f924edb592e1819ed64b31172ab8de9d5cde75d3f46acd9506202ab9b1cbb97e381c5aa11037f17e5ed7b4b609461cd813d944670549d410ef82f2e" +} +``` + ## Errors | HTTP Status Code | Error Description | Exception Class | @@ -465,20 +433,20 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Config Cmd +# Monitor Site Device Traffic -Get Config CLI Commands -For a brown-field switch deployment where we adopted the switch through Adoption Command, we do not wipe out / overwrite the existing config automatically. Instead, we generate CLI commands that we would have generated. The user can inspect, modify, and incorporate this into their existing config manually. +Monitor traffic on switches and SRX. -Once they feel comfortable about the config we generate, they can enable allow_mist_config where we will take full control of their config like a claimed switch +* JUNOS uses cmd "monitor interface " to monitor traffic on particular +* JUNOS uses cmd "monitor interface traffic" to monitor traffic on all ports ```go -GetSiteDeviceConfigCmd( +MonitorSiteDeviceTraffic( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - sort *bool) ( - models.ApiResponse[models.ResponseDeviceConfigCli], + body *models.UtilsMonitorTraffic) ( + models.ApiResponse[models.WebsocketSessionWithUrl], error) ``` @@ -488,11 +456,11 @@ GetSiteDeviceConfigCmd( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `sort` | `*bool` | Query, Optional | Make output cmds sorted (for better readability) or not.
**Default**: `false` | +| `body` | [`*models.UtilsMonitorTraffic`](../../doc/models/utils-monitor-traffic.md) | Body, Optional | - | ## Response Type -[`models.ResponseDeviceConfigCli`](../../doc/models/response-device-config-cli.md) +[`models.WebsocketSessionWithUrl`](../../doc/models/websocket-session-with-url.md) ## Example Usage @@ -503,9 +471,11 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -sort := false +body := models.UtilsMonitorTraffic{ + Port: models.ToPointer("ge-0/0/1"), +} -apiResponse, err := utilitiesCommon.GetSiteDeviceConfigCmd(ctx, siteId, deviceId, &sort) +apiResponse, err := utilitiesCommon.MonitorSiteDeviceTraffic(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -515,16 +485,6 @@ if err != nil { } ``` -## Example Response *(as JSON)* - -```json -{ - "cli": [ - "set system hostname corp-a135" - ] -} -``` - ## Errors | HTTP Status Code | Error Description | Exception Class | @@ -536,16 +496,41 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Evpn Database +# Ping From Device -Get EVPN Database from the Device. The output will be available through websocket. +Ping from AP, Switch and SSR + +Ping can be performed from the Device. The output will be available through websocket. As there can be multiple command issued against the same AP at the same time and the output all goes through the same websocket stream, session is introduced for demux. + +#### Subscribe to Device Command outputs + +`WS /api-ws/v1/stream` + +```json +{ + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +} +``` + +##### Example output from ws stream + +```json +{ + "event": "data", + "channel": "/sites/4ac1dcf4-9d8b-7211-65c4-057819f0862b/devices/00000000-0000-0000-1000-5c5b350e0060/cmd", + "data": { + "session": "session_id", + "raw": "64 bytes from 23.211.0.110: seq=8 ttl=58 time=12.323 ms\n" + } +} +``` ```go -GetSiteDeviceEvpnDatabase( +PingFromDevice( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowEvpnDatabase) ( + body *models.UtilsPing) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -556,7 +541,7 @@ GetSiteDeviceEvpnDatabase( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowEvpnDatabase`](../../doc/models/utils-show-evpn-database.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsPing`](../../doc/models/utils-ping.md) | Body, Optional | Request Body | ## Response Type @@ -571,14 +556,12 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowEvpnDatabase{ - Duration: models.ToPointer(0), - Interval: models.ToPointer(0), - Mac: models.ToPointer("f8c1165c6400"), - PortId: models.ToPointer("ge-0/0/0.0"), +body := models.UtilsPing{ + Count: models.ToPointer(10), + Host: "1.1.1.1", } -apiResponse, err := utilitiesCommon.GetSiteDeviceEvpnDatabase(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesCommon.PingFromDevice(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -599,34 +582,16 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Forwarding Table +# Readopt Site Octerm Device -Get forwarding table from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. - -#### Subscribe to Device Command outputs - -`WS /api-ws/v1/stream` - -```json -{ - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -} -``` - -##### Example output from ws stream - -``` -Mon 2024-05-20 16:47:30 UTC Retrieving fib entries… Entry Count: 3268 Capacity: 22668 ==================== ====== ======= ================== ===== ====================== =========== =========== ====== IP Prefix Port Proto Tenant VRF Service Next Hops Vector Cost ==================== ====== ======= ================== ===== ====================== =========== =========== ====== 0.0.0.0/0 0 None Old_Mgmt - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-Kiosk - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-MGT - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 3.1.1.0/24 0 None Old_Mgmt - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-Kiosk - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-MGT - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 - -``` +For the octerm devices, the device ID must come from fpc0. However, for a VC, the users may change the original fpc0 from CLI. To fix the issue, the readopt API could be used to trigger the readopt process so the device would get the corret device ID to connect the cloud. ```go -GetSiteDeviceForwardingTable( +ReadoptSiteOctermDevice( ctx context.Context, siteId uuid.UUID, - deviceId uuid.UUID, - body *models.UtilsShowForwardingTable) ( - models.ApiResponse[models.WebsocketSession], + deviceId uuid.UUID) ( + http.Response, error) ``` @@ -636,11 +601,10 @@ GetSiteDeviceForwardingTable( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowForwardingTable`](../../doc/models/utils-show-forwarding-table.md) | Body, Optional | all attributes are optional | ## Response Type -[`models.WebsocketSession`](../../doc/models/websocket-session.md) +`` ## Example Usage @@ -651,23 +615,11 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowForwardingTable{ - Prefix: models.ToPointer("3.1.1.0/24"), - ServiceIp: models.ToPointer("3.1.1.10"), - ServiceName: models.ToPointer("internet-wan_and_lte"), - ServicePort: models.ToPointer(32768), - ServiceProtocol: models.ToPointer("udp"), - ServiceTenant: models.ToPointer("branch1-wifi-mgt"), - Vrf: models.ToPointer("guest"), -} - -apiResponse, err := utilitiesCommon.GetSiteDeviceForwardingTable(ctx, siteId, deviceId, &body) +resp, err := utilitiesCommon.ReadoptSiteOctermDevice(ctx, siteId, deviceId) if err != nil { log.Fatalln(err) } else { - // Printing the result and response - fmt.Println(apiResponse.Data) - fmt.Println(apiResponse.Response.StatusCode) + fmt.Println(resp.StatusCode) } ``` @@ -682,29 +634,17 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Mac Table +# Release Site Device Dhcp Lease -Get MAC Table from the Device. - -The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. - -#### Subscribe to Device Command outputs - -`WS /api-ws/v1/stream` - -```json -{ - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -} -``` +Releases an active DHCP lease. ```go -GetSiteDeviceMacTable( +ReleaseSiteDeviceDhcpLease( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsMacTable) ( - models.ApiResponse[models.WebsocketSession], + body *models.UtilsReleaseDhcpLeases) ( + http.Response, error) ``` @@ -714,11 +654,11 @@ GetSiteDeviceMacTable( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsMacTable`](../../doc/models/utils-mac-table.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsReleaseDhcpLeases`](../../doc/models/utils-release-dhcp-leases.md) | Body, Optional | - | ## Response Type -[`models.WebsocketSession`](../../doc/models/websocket-session.md) +`` ## Example Usage @@ -729,19 +669,15 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsMacTable{ - MacAddress: models.ToPointer("f8c1165c6400"), - PortId: models.ToPointer("ge-0/0/0.0"), - VlanId: models.ToPointer("ge-0/0/0.0"), +body := models.UtilsReleaseDhcpLeases{ + PortId: "ge-0/0/1.10", } -apiResponse, err := utilitiesCommon.GetSiteDeviceMacTable(ctx, siteId, deviceId, &body) +resp, err := utilitiesCommon.ReleaseSiteDeviceDhcpLease(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { - // Printing the result and response - fmt.Println(apiResponse.Data) - fmt.Println(apiResponse.Response.StatusCode) + fmt.Println(resp.StatusCode) } ``` @@ -749,23 +685,23 @@ if err != nil { | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Bad Syntax | [`ResponseHttp400Exception`](../../doc/models/response-http-400-exception.md) | +| 400 | Parameter `port` absent | `ApiError` | | 401 | Unauthorized | [`ResponseHttp401ErrorException`](../../doc/models/response-http-401-error-exception.md) | | 403 | Permission Denied | [`ResponseHttp403ErrorException`](../../doc/models/response-http-403-error-exception.md) | | 404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | [`ResponseHttp404Exception`](../../doc/models/response-http-404-exception.md) | | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Device Ztp Password +# Reprovision Site Octerm Device -In the case where soemthing happens during/after ZTP, the root-password is modified (required for ZTP to set up outbound-ssh) but the user-defined password config has not be configured. This API can be used to retrieve the temporary password. +To force one device to reprovision itself again. ```go -GetSiteDeviceZtpPassword( +ReprovisionSiteOctermDevice( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID) ( - models.ApiResponse[models.RootPasswordString], + http.Response, error) ``` @@ -778,7 +714,7 @@ GetSiteDeviceZtpPassword( ## Response Type -[`models.RootPasswordString`](../../doc/models/root-password-string.md) +`` ## Example Usage @@ -789,21 +725,11 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -apiResponse, err := utilitiesCommon.GetSiteDeviceZtpPassword(ctx, siteId, deviceId) +resp, err := utilitiesCommon.ReprovisionSiteOctermDevice(ctx, siteId, deviceId) if err != nil { log.Fatalln(err) } else { - // Printing the result and response - fmt.Println(apiResponse.Data) - fmt.Println(apiResponse.Response.StatusCode) -} -``` - -## Example Response *(as JSON)* - -```json -{ - "root_password": "ef8070ef8f924edb592e1819ed64b31172ab8de9d5cde75d3f46acd9506202ab9b1cbb97e381c5aa11037f17e5ed7b4b609461cd813d944670549d410ef82f2e" + fmt.Println(resp.StatusCode) } ``` @@ -818,20 +744,17 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Monitor Site Device Traffic +# Restart Site Device -Monitor traffic on switches and SRX. - -* JUNOS uses cmd "monitor interface " to monitor traffic on particular -* JUNOS uses cmd "monitor interface traffic" to monitor traffic on all ports +Restart / Reboot a device ```go -MonitorSiteDeviceTraffic( +RestartSiteDevice( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsMonitorTraffic) ( - models.ApiResponse[models.WebsocketSessionWithUrl], + body *models.UtilsDevicesRestart) ( + http.Response, error) ``` @@ -841,11 +764,11 @@ MonitorSiteDeviceTraffic( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsMonitorTraffic`](../../doc/models/utils-monitor-traffic.md) | Body, Optional | - | +| `body` | [`*models.UtilsDevicesRestart`](../../doc/models/utils-devices-restart.md) | Body, Optional | - | ## Response Type -[`models.WebsocketSessionWithUrl`](../../doc/models/websocket-session-with-url.md) +`` ## Example Usage @@ -856,17 +779,13 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsMonitorTraffic{ - Port: models.ToPointer("ge-0/0/1"), -} -apiResponse, err := utilitiesCommon.MonitorSiteDeviceTraffic(ctx, siteId, deviceId, &body) + +resp, err := utilitiesCommon.RestartSiteDevice(ctx, siteId, deviceId, nil) if err != nil { log.Fatalln(err) } else { - // Printing the result and response - fmt.Println(apiResponse.Data) - fmt.Println(apiResponse.Response.StatusCode) + fmt.Println(resp.StatusCode) } ``` @@ -881,11 +800,11 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Ping From Device +# Show Site Device Arp Table -Ping from AP, Switch and SSR +Get ARP Table from the Device. -Ping can be performed from the Device. The output will be available through websocket. As there can be multiple command issued against the same AP at the same time and the output all goes through the same websocket stream, session is introduced for demux. +The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. #### Subscribe to Device Command outputs @@ -895,27 +814,14 @@ Ping can be performed from the Device. The output will be available through webs { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" } -``` - -##### Example output from ws stream - -```json -{ - "event": "data", - "channel": "/sites/4ac1dcf4-9d8b-7211-65c4-057819f0862b/devices/00000000-0000-0000-1000-5c5b350e0060/cmd", - "data": { - "session": "session_id", - "raw": "64 bytes from 23.211.0.110: seq=8 ttl=58 time=12.323 ms\n" - } -} ``` ```go -PingFromDevice( +ShowSiteDeviceArpTable( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsPing) ( + body *models.UtilsShowArp) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -926,7 +832,7 @@ PingFromDevice( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsPing`](../../doc/models/utils-ping.md) | Body, Optional | Request Body | +| `body` | [`*models.UtilsShowArp`](../../doc/models/utils-show-arp.md) | Body, Optional | all attributes are optional | ## Response Type @@ -941,12 +847,15 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsPing{ - Count: models.ToPointer(10), - Host: "1.1.1.1", +body := models.UtilsShowArp{ + Duration: models.ToPointer(0), + Interval: models.ToPointer(0), + Ip: models.ToPointer("192.168.30.7"), + PortId: models.ToPointer("ge-0/0/0.0"), + Vrf: models.ToPointer("guest"), } -apiResponse, err := utilitiesCommon.PingFromDevice(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesCommon.ShowSiteDeviceArpTable(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -967,16 +876,48 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Readopt Site Octerm Device +# Show Site Device Bgp Summary -For the octerm devices, the device ID must come from fpc0. However, for a VC, the users may change the original fpc0 from CLI. To fix the issue, the readopt API could be used to trigger the readopt process so the device would get the corret device ID to connect the cloud. +Get BGP Summary from SSR, SRX and Switch. + +The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. + +#### Subscribe to Device Command outputs + +`WS /api-ws/v1/stream` + +```json +{ + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" + +} +``` + +##### Example output from ws stream + +``` +Tue 2024-04-23 16:36:06 UTC +Retrieving bgp entries... +BGP table version is 354, local router ID is 10.224.8.16, vrf id 0 +Default local pref 100, local AS 65000 +Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, + i internal, r RIB_failure, S Stale, R Removed +Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + + Network Next Hop Metric LocPrf Weight Path +*> 161.161.161.0/24 +```" +``` ```go -ReadoptSiteOctermDevice( +ShowSiteDeviceBgpSummary( ctx context.Context, siteId uuid.UUID, - deviceId uuid.UUID) ( - http.Response, + deviceId uuid.UUID, + body *models.UtilsShowBgpRummary) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -986,10 +927,11 @@ ReadoptSiteOctermDevice( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | +| `body` | [`*models.UtilsShowBgpRummary`](../../doc/models/utils-show-bgp-rummary.md) | Body, Optional | all attributes are optional | ## Response Type -`` +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -1000,11 +942,15 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -resp, err := utilitiesCommon.ReadoptSiteOctermDevice(ctx, siteId, deviceId) + + +apiResponse, err := utilitiesCommon.ShowSiteDeviceBgpSummary(ctx, siteId, deviceId, nil) if err != nil { log.Fatalln(err) } else { - fmt.Println(resp.StatusCode) + // Printing the result and response + fmt.Println(apiResponse.Data) + fmt.Println(apiResponse.Response.StatusCode) } ``` @@ -1019,17 +965,17 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Release Site Device Dhcp Lease +# Show Site Device Dhcp Leases -Releases an active DHCP lease. +Shows DHCP leases ```go -ReleaseSiteDeviceDhcpLease( +ShowSiteDeviceDhcpLeases( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsReleaseDhcpLeases) ( - http.Response, + body *models.UtilsShowDhcpLeases) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -1039,11 +985,11 @@ ReleaseSiteDeviceDhcpLease( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsReleaseDhcpLeases`](../../doc/models/utils-release-dhcp-leases.md) | Body, Optional | - | +| `body` | [`*models.UtilsShowDhcpLeases`](../../doc/models/utils-show-dhcp-leases.md) | Body, Optional | - | ## Response Type -`` +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -1054,15 +1000,17 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsReleaseDhcpLeases{ - PortId: "ge-0/0/1.10", +body := models.UtilsShowDhcpLeases{ + Network: "guest", } -resp, err := utilitiesCommon.ReleaseSiteDeviceDhcpLease(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesCommon.ShowSiteDeviceDhcpLeases(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { - fmt.Println(resp.StatusCode) + // Printing the result and response + fmt.Println(apiResponse.Data) + fmt.Println(apiResponse.Response.StatusCode) } ``` @@ -1070,23 +1018,24 @@ if err != nil { | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Parameter `port` absent | `ApiError` | +| 400 | Bad Syntax | [`ResponseHttp400Exception`](../../doc/models/response-http-400-exception.md) | | 401 | Unauthorized | [`ResponseHttp401ErrorException`](../../doc/models/response-http-401-error-exception.md) | | 403 | Permission Denied | [`ResponseHttp403ErrorException`](../../doc/models/response-http-403-error-exception.md) | | 404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | [`ResponseHttp404Exception`](../../doc/models/response-http-404-exception.md) | | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Reprovision Site Octerm Device +# Show Site Device Evpn Database -To force one device to reprovision itself again. +Get EVPN Database from the Device. The output will be available through websocket. ```go -ReprovisionSiteOctermDevice( +ShowSiteDeviceEvpnDatabase( ctx context.Context, siteId uuid.UUID, - deviceId uuid.UUID) ( - http.Response, + deviceId uuid.UUID, + body *models.UtilsShowEvpnDatabase) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -1096,10 +1045,11 @@ ReprovisionSiteOctermDevice( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | +| `body` | [`*models.UtilsShowEvpnDatabase`](../../doc/models/utils-show-evpn-database.md) | Body, Optional | all attributes are optional | ## Response Type -`` +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -1110,11 +1060,20 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -resp, err := utilitiesCommon.ReprovisionSiteOctermDevice(ctx, siteId, deviceId) +body := models.UtilsShowEvpnDatabase{ + Duration: models.ToPointer(0), + Interval: models.ToPointer(0), + Mac: models.ToPointer("f8c1165c6400"), + PortId: models.ToPointer("ge-0/0/0.0"), +} + +apiResponse, err := utilitiesCommon.ShowSiteDeviceEvpnDatabase(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { - fmt.Println(resp.StatusCode) + // Printing the result and response + fmt.Println(apiResponse.Data) + fmt.Println(apiResponse.Response.StatusCode) } ``` @@ -1129,17 +1088,34 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Restart Site Device +# Show Site Device Forwarding Table -Restart / Reboot a device +Get forwarding table from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. + +#### Subscribe to Device Command outputs + +`WS /api-ws/v1/stream` + +```json +{ + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +} +``` + +##### Example output from ws stream + +``` +Mon 2024-05-20 16:47:30 UTC Retrieving fib entries… Entry Count: 3268 Capacity: 22668 ==================== ====== ======= ================== ===== ====================== =========== =========== ====== IP Prefix Port Proto Tenant VRF Service Next Hops Vector Cost ==================== ====== ======= ================== ===== ====================== =========== =========== ====== 0.0.0.0/0 0 None Old_Mgmt - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-Kiosk - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-MGT - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 3.1.1.0/24 0 None Old_Mgmt - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-Kiosk - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-MGT - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 + +``` ```go -RestartSiteDevice( +ShowSiteDeviceForwardingTable( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsDevicesRestart) ( - http.Response, + body *models.UtilsShowForwardingTable) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -1149,11 +1125,11 @@ RestartSiteDevice( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsDevicesRestart`](../../doc/models/utils-devices-restart.md) | Body, Optional | - | +| `body` | [`*models.UtilsShowForwardingTable`](../../doc/models/utils-show-forwarding-table.md) | Body, Optional | all attributes are optional | ## Response Type -`` +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -1164,13 +1140,23 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") +body := models.UtilsShowForwardingTable{ + Prefix: models.ToPointer("3.1.1.0/24"), + ServiceIp: models.ToPointer("3.1.1.10"), + ServiceName: models.ToPointer("internet-wan_and_lte"), + ServicePort: models.ToPointer(32768), + ServiceProtocol: models.ToPointer("udp"), + ServiceTenant: models.ToPointer("branch1-wifi-mgt"), + Vrf: models.ToPointer("guest"), +} - -resp, err := utilitiesCommon.RestartSiteDevice(ctx, siteId, deviceId, nil) +apiResponse, err := utilitiesCommon.ShowSiteDeviceForwardingTable(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { - fmt.Println(resp.StatusCode) + // Printing the result and response + fmt.Println(apiResponse.Data) + fmt.Println(apiResponse.Response.StatusCode) } ``` @@ -1185,17 +1171,29 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Show Site Device Dhcp Leases +# Show Site Device Mac Table -Shows DHCP leases +Get MAC Table from the Device. + +The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. + +#### Subscribe to Device Command outputs + +`WS /api-ws/v1/stream` + +```json +{ + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +} +``` ```go -ShowSiteDeviceDhcpLeases( +ShowSiteDeviceMacTable( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowDhcpLeases) ( - models.ApiResponse[models.WebsocketSessionWithUrl], + body *models.UtilsMacTable) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -1205,11 +1203,11 @@ ShowSiteDeviceDhcpLeases( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowDhcpLeases`](../../doc/models/utils-show-dhcp-leases.md) | Body, Optional | - | +| `body` | [`*models.UtilsMacTable`](../../doc/models/utils-mac-table.md) | Body, Optional | all attributes are optional | ## Response Type -[`models.WebsocketSessionWithUrl`](../../doc/models/websocket-session-with-url.md) +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -1220,11 +1218,13 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowDhcpLeases{ - Network: models.ToPointer("guest"), +body := models.UtilsMacTable{ + MacAddress: models.ToPointer("f8c1165c6400"), + PortId: models.ToPointer("ge-0/0/0.0"), + VlanId: models.ToPointer("ge-0/0/0.0"), } -apiResponse, err := utilitiesCommon.ShowSiteDeviceDhcpLeases(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesCommon.ShowSiteDeviceMacTable(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -1373,7 +1373,7 @@ if err != nil { Traceroute can be performed from the Device. -The output will be available through websocket. As there can be multiple command issued against the same AP at the same time and the output all goes through the same websocket stream, session is introduced for demux. +The output will be available through websocket. As there can be multiple command issued against the same Device at the same time and the output all goes through the same websocket stream, session is introduced for demux. #### Subscribe to Device Command outputs @@ -1382,8 +1382,24 @@ The output will be available through websocket. As there can be multiple command ```json { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +}``` + + + +#### Example output from ws stream + +```json +{ + "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", + "event": "data", + "data": { + "session": "9106e908-74dc-4a4f-9050-9c2adcaf44a5", + "raw": "Running traceroute...\ntraceroute to 8.8.8.8, 64 hops max\n 0 192.168.1.1 1 ms 192.168.1.1 1 ms 192.168.1.1 1 ms\n 1 80.10.236.81 2 ms 80.10.236.81 4 ms 80.10.236.81 2 ms\n 2 193.253.80.250 3 ms 193.253.80.250 2 ms 193.253.80.250 2 ms\n 3 193.252.159.41 2 ms 193.252.159.41 1 ms 193.252.159.41 3 ms\n" + } } -``` +``` + +" ```go TracerouteFromDevice( @@ -1449,15 +1465,16 @@ Support / Upload device support files #### Info Param -**Parameter**|**Description** -:-------------: |:-------------: |:-------------: -process|Upload 1 file with output of show system processes extensive -outbound-ssh|Upload 1 file that concatenates all /var/log/outbound-ssh.log* files -messages|Upload 1 to 10 /var/log/messages* files -core-dumps|Upload all core dump files, if any -full|string|Upload 1 file with output of request support information, 1 file that concatenates all /var/log/outbound-ssh.log files, all core dump files, the 3 most recent /var/log/messages files, and Mist agent logs (for Junos devices running the Mist agent) -var-logs|Upload all non-empty files in the /var/log/ directory -jma-logs|Upload Mist agent logs (for Junos devices running the Mist agent only) +| Name | Type | Description | +| --- | --- | --- | +| process | string | Upload 1 file with output of show system processes extensive | +| outbound-ssh | string | Upload 1 file that concatenates all /var/log/outbound-ssh.log* files | +| messages | string | Upload 1 to 10 /var/log/messages* files | +| core-dumps | string | Upload all core dump files, if any | +| full | string | Upload 1 file with output of request support information, 1 file that concatenates all /var/log/outbound-ssh.log files, all core dump files, the 3 most recent /var/log/messages files, and Mist agent logs (for Junos devices running the Mist agent) | +| var-logs | string | Upload all non-empty files in the /var/log/ directory | +| jma-logs | string | Upload Mist agent logs (for Junos devices running the Mist agent only) | +" ```go UploadSiteDeviceSupportFile( diff --git a/doc/controllers/utilities-pca-ps.md b/doc/controllers/utilities-pca-ps.md index 50208056..a6b63814 100644 --- a/doc/controllers/utilities-pca-ps.md +++ b/doc/controllers/utilities-pca-ps.md @@ -367,7 +367,7 @@ The output will be available through websocket. As there can be multiple command ```json { - subscribe: "/sites/{site_id}/pcaps" + "subscribe": "/sites/{site_id}/pcaps" } ``` @@ -501,7 +501,7 @@ The output will be available through websocket. As there can be multiple command ```json { - subscribe: "/sites/{site_id}/pcaps" + "subscribe": "/sites/{site_id}/pcaps" } ``` @@ -536,7 +536,7 @@ The output will be available through websocket. As there can be multiple command } ``` -#### vResponse (Wired) +#### Response (Wired) ```json { diff --git a/doc/controllers/utilities-wan.md b/doc/controllers/utilities-wan.md index 883c764d..9d00f156 100644 --- a/doc/controllers/utilities-wan.md +++ b/doc/controllers/utilities-wan.md @@ -13,16 +13,16 @@ utilitiesWAN := client.UtilitiesWAN() * [Clear Site Device Session](../../doc/controllers/utilities-wan.md#clear-site-device-session) * [Clear Site Ssr Arp Cache](../../doc/controllers/utilities-wan.md#clear-site-ssr-arp-cache) * [Clear Site Ssr Bgp Routes](../../doc/controllers/utilities-wan.md#clear-site-ssr-bgp-routes) -* [Get Site Ssr and Srx Routes](../../doc/controllers/utilities-wan.md#get-site-ssr-and-srx-routes) -* [Get Site Ssr and Srx Sessions](../../doc/controllers/utilities-wan.md#get-site-ssr-and-srx-sessions) -* [Get Site Ssr Ospf Database](../../doc/controllers/utilities-wan.md#get-site-ssr-ospf-database) -* [Get Site Ssr Ospf Interface](../../doc/controllers/utilities-wan.md#get-site-ssr-ospf-interface) -* [Get Site Ssr Ospf Neighbors](../../doc/controllers/utilities-wan.md#get-site-ssr-ospf-neighbors) -* [Get Site Ssr Ospf Summary](../../doc/controllers/utilities-wan.md#get-site-ssr-ospf-summary) -* [Get Site Ssr Service Path](../../doc/controllers/utilities-wan.md#get-site-ssr-service-path) * [Release Site Ssr Dhcp Lease](../../doc/controllers/utilities-wan.md#release-site-ssr-dhcp-lease) * [Run Site Srx Top Command](../../doc/controllers/utilities-wan.md#run-site-srx-top-command) * [Service Ping From Ssr](../../doc/controllers/utilities-wan.md#service-ping-from-ssr) +* [Show Site Ssr and Srx Routes](../../doc/controllers/utilities-wan.md#show-site-ssr-and-srx-routes) +* [Show Site Ssr and Srx Sessions](../../doc/controllers/utilities-wan.md#show-site-ssr-and-srx-sessions) +* [Show Site Ssr Ospf Database](../../doc/controllers/utilities-wan.md#show-site-ssr-ospf-database) +* [Show Site Ssr Ospf Interfaces](../../doc/controllers/utilities-wan.md#show-site-ssr-ospf-interfaces) +* [Show Site Ssr Ospf Neighbors](../../doc/controllers/utilities-wan.md#show-site-ssr-ospf-neighbors) +* [Show Site Ssr Ospf Summary](../../doc/controllers/utilities-wan.md#show-site-ssr-ospf-summary) +* [Show Site Ssr Service Path](../../doc/controllers/utilities-wan.md#show-site-ssr-service-path) * [Test Site Ssr Dns Resolution](../../doc/controllers/utilities-wan.md#test-site-ssr-dns-resolution) @@ -212,11 +212,11 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr and Srx Routes +# Release Site Ssr Dhcp Lease -Get routes from SSR, SRX and Switch. +Releases an active DHCP lease. -The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. +The output will be available through websocket. As there can be multiple command issued against the same Device at the same time and the output all goes through the same websocket stream, session is introduced for demux. #### Subscribe to Device Command outputs @@ -225,36 +225,31 @@ The output will be available through websocket. As there can be multiple command ```json { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -} -``` +}``` -##### Example output from ws stream + +#### Example output from ws stream + +```json +{ + "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", + "event": "data", + "data": { + "session": "9106e908-74dc-4a4f-9050-9c2adcaf44a5", + "raw": "Running traceroute...\ntraceroute to 8.8.8.8, 64 hops max\n 0 192.168.1.1 1 ms 192.168.1.1 1 ms 192.168.1.1 1 ms\n 1 80.10.236.81 2 ms 80.10.236.81 4 ms 80.10.236.81 2 ms\n 2 193.253.80.250 3 ms 193.253.80.250 2 ms 193.253.80.250 2 ms\n 3 193.252.159.41 2 ms 193.252.159.41 1 ms 193.252.159.41 3 ms\n" + } +} ``` -admin@labsystem1.fiedler# show bgp neighbors -BGP neighbor is 192.168.4.1, remote AS 4200000001, local AS 4200000128, external -link - BGP version 4, remote router ID 1.1.1.1 - BGP state = Established, up for 00:27:25 - Last read 00:00:25, hold time is 90, keepalive interval is 30 seconds - Configured hold time is 90, keepalive interval is 30 seconds - Neighbor capabilities: - 4 Byte AS: advertised and received - Route refresh: advertised and received(old & new) - Address family IPv4 Unicast: advertised and received - Graceful Restart Capabilty: advertised and received - Remote Restart timer is 120 seconds - Address families by peer: - none - ... -``` + +" ```go -GetSiteSsrAndSrxRoutes( +ReleaseSiteSsrDhcpLease( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowRoute) ( + body *models.UtilsReleaseDhcp) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -265,7 +260,7 @@ GetSiteSsrAndSrxRoutes( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowRoute`](../../doc/models/utils-show-route.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsReleaseDhcp`](../../doc/models/utils-release-dhcp.md) | Body, Optional | - | ## Response Type @@ -280,17 +275,11 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowRoute{ - Duration: models.ToPointer(0), - Interval: models.ToPointer(0), - Neighbor: models.ToPointer("192.168.4.1"), - Prefix: models.ToPointer("192.168.0.5/30"), - Protocol: models.ToPointer(models.UtilsShowRouteProtocolEnum("bgp")), - Route: models.ToPointer("advertised"), - Vrf: models.ToPointer("default"), +body := models.UtilsReleaseDhcp{ + PortId: "ge-0/0/1.10", } -apiResponse, err := utilitiesWAN.GetSiteSsrAndSrxRoutes(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ReleaseSiteSsrDhcpLease(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -304,18 +293,18 @@ if err != nil { | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Bad Syntax | [`ResponseHttp400Exception`](../../doc/models/response-http-400-exception.md) | +| 400 | Parameter `port` absent | `ApiError` | | 401 | Unauthorized | [`ResponseHttp401ErrorException`](../../doc/models/response-http-401-error-exception.md) | | 403 | Permission Denied | [`ResponseHttp403ErrorException`](../../doc/models/response-http-403-error-exception.md) | | 404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | [`ResponseHttp404Exception`](../../doc/models/response-http-404-exception.md) | | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr and Srx Sessions +# Run Site Srx Top Command -Get active sessions passing through the Device. +Run top command on switches and SRX. The output will be available through websocket. -The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. +As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. #### Subscribe to Device Command outputs @@ -323,61 +312,16 @@ The output will be available through websocket. As there can be multiple command ```json { - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" - } -``` - -##### Example output from ws stream - -```console -admin@ssr.node# show sessions -Fri 2020-04-17 16:55:34 UTC - -Node: node1 - -====================================== ===== ============= =========== ========== ====== ======= ================= ========== ================= =========== ================= ========== =================== ========= ================= -Session Id Dir Service Tenant Dev Name VLAN Proto Src IP Src Port Dest IP Dest Port NAT IP NAT Port Payload Encrypted Timeout Uptime -====================================== ===== ============= =========== ========== ====== ======= ================= ========== ================= =========== ================= ========== =================== ========= ================= -01187fb8-765a-45e5-ae90-37d77f15e292 fwd Internet lanSubnet lan 0 udp 192.168.0.28 44674 35.166.173.18 9930 96.230.191.130 19569 false 154 0 days 0:00:28 -01187fb8-765a-45e5-ae90-37d77f15e292 rev Internet lanSubnet wan 0 udp 35.166.173.18 9930 96.230.191.130 19569 0.0.0.0 0 false 154 0 days 0:00:28 -0859a4ae-bcff-4aa6-b812-79a5236a6c13 fwd Internet lanSubnet lan 0 tcp 192.168.0.41 60843 17.249.171.246 443 96.230.191.130 51941 false 2 0 days 0:00:10 - - -admin@node0.90ec7732e327# show sessions by-id 262900cd-bca8-443a-8aab-e5c93d147ab5 -Wed 2024-06-26 20:37:48 UTC -Retrieving session information... - -======================================================================================================================================================================================= -90ec7732e327.node0 Session ID: 262900cd-bca8-443a-8aab-e5c93d147ab5 -======================================================================================================================================================================================= -Service Name: Internet -Service Route Name: Internet-sr-local-breakout-1-node0 -Session Source: SourceType: PUBLIC -Session Type: HTTPS -Service Class: service-class-0-low -Source Tenant: LAN -Peer Name: N/A -Inter Node: N/A -Inter Router: N/A -Ingress Source Nat: N/A -Payload Security Policy: internal -Payload Encrypted: True -Common Name Info: N/A -Tcp Time To Establish: 76 -Tls Time To Establish: 76 -Domain Name: N/A -Uri: N/A -Category: N/A -```" + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +} ``` ```go -GetSiteSsrAndSrxSessions( +RunSiteSrxTopCommand( ctx context.Context, siteId uuid.UUID, - deviceId uuid.UUID, - body *models.UtilsShowSession) ( - models.ApiResponse[models.WebsocketSession], + deviceId uuid.UUID) ( + models.ApiResponse[models.WebsocketSessionWithUrl], error) ``` @@ -387,11 +331,10 @@ GetSiteSsrAndSrxSessions( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowSession`](../../doc/models/utils-show-session.md) | Body, Optional | - | ## Response Type -[`models.WebsocketSession`](../../doc/models/websocket-session.md) +[`models.WebsocketSessionWithUrl`](../../doc/models/websocket-session-with-url.md) ## Example Usage @@ -402,12 +345,7 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowSession{ - Node: models.ToPointer(models.HaClusterNodeEnum("node0")), - ServiceName: models.ToPointer("any"), -} - -apiResponse, err := utilitiesWAN.GetSiteSsrAndSrxSessions(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.RunSiteSrxTopCommand(ctx, siteId, deviceId) if err != nil { log.Fatalln(err) } else { @@ -428,11 +366,11 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr Ospf Database +# Service Ping From Ssr -Get OSPF Database from the Device. The output will be available through websocket. +Ping from SSR -As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. +Service Ping can be performed from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. #### Subscribe to Device Command outputs @@ -440,28 +378,29 @@ As there can be multiple command issued against the same device at the same time ```json { - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" } ``` -#### Example output from ws stream +##### Example output from ws stream -``` -===== ==================== ========== ======= ======== ================ =================== ================= -Vrf Neighbor Router ID Priority State Uptime Dead Timer Due Interface Address Interface State -===== ==================== ========== ======= ======== ================ =================== ================= - 1.0.0.3 1 Full 852 38 172.16.3.2 Backup - 1.0.0.4 1 Full 811 33 172.16.3.2 DROther - 1.0.0.3 1 Full 852 38 172.16.4.2 Backup - 1.0.0.4 1 Full 811 34 172.16.4.2 DROther +```json +{ + "event": "data", + "channel": "/sites/4ac1dcf4-9d8b-7211-65c4-057819f0862b/devices/00000000-0000-0000-1000-5c5b350e0060/cmd", + "data": { + "session": "session_id", + "raw": "64 bytes from 23.211.0.110: seq=8 ttl=58 time=12.323 ms\n" + } +} ``` ```go -GetSiteSsrOspfDatabase( +ServicePingFromSsr( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowOspfDatabase) ( + body *models.UtilsServicePing) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -472,7 +411,7 @@ GetSiteSsrOspfDatabase( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowOspfDatabase`](../../doc/models/utils-show-ospf-database.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsServicePing`](../../doc/models/utils-service-ping.md) | Body, Optional | Request Body | ## Response Type @@ -487,12 +426,13 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowOspfDatabase{ - SelfOriginate: models.ToPointer(false), - Vrf: models.ToPointer("lan"), +body := models.UtilsServicePing{ + Count: models.ToPointer(10), + Host: "1.1.1.1", + Service: "web-session", } -apiResponse, err := utilitiesWAN.GetSiteSsrOspfDatabase(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ServicePingFromSsr(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -513,11 +453,11 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr Ospf Interface +# Show Site Ssr and Srx Routes -Get OSPF interfaces from the Device. The output will be available through websocket. +Get routes from SSR, SRX and Switch. -As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. +The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. #### Subscribe to Device Command outputs @@ -525,27 +465,37 @@ As there can be multiple command issued against the same device at the same time ```json { - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" } ``` -#### Example output from ws stream +##### Example output from ws stream ``` -===== ================== =================== ============== =============== =========== ========= =========== -Vrf Device Interface Network Interface Interface Up IP Address OSPF Type Area ID Area Type -===== ================== =================== ============== =============== =========== ========= =========== - net1 g1 True 172.16.1.2/24 Broadcast 0.0.0.0 default - net3 g3 True 172.16.3.2/24 Broadcast 0.0.0.0 default - net4 g4 True 172.16.4.2/24 Broadcast 0.0.0.4 default +admin@labsystem1.fiedler# show bgp neighbors +BGP neighbor is 192.168.4.1, remote AS 4200000001, local AS 4200000128, external +link + BGP version 4, remote router ID 1.1.1.1 + BGP state = Established, up for 00:27:25 + Last read 00:00:25, hold time is 90, keepalive interval is 30 seconds + Configured hold time is 90, keepalive interval is 30 seconds + Neighbor capabilities: + 4 Byte AS: advertised and received + Route refresh: advertised and received(old & new) + Address family IPv4 Unicast: advertised and received + Graceful Restart Capabilty: advertised and received + Remote Restart timer is 120 seconds + Address families by peer: + none + ... ``` ```go -GetSiteSsrOspfInterface( +ShowSiteSsrAndSrxRoutes( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowOspfInterfaces) ( + body *models.UtilsShowRoute) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -556,7 +506,7 @@ GetSiteSsrOspfInterface( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowOspfInterfaces`](../../doc/models/utils-show-ospf-interfaces.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsShowRoute`](../../doc/models/utils-show-route.md) | Body, Optional | all attributes are optional | ## Response Type @@ -571,12 +521,17 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowOspfInterfaces{ - PortId: models.ToPointer("ge-0/0/3"), - Vrf: models.ToPointer("lan"), +body := models.UtilsShowRoute{ + Duration: models.ToPointer(0), + Interval: models.ToPointer(0), + Neighbor: models.ToPointer("192.168.4.1"), + Prefix: models.ToPointer("192.168.0.5/30"), + Protocol: models.ToPointer(models.UtilsShowRouteProtocolEnum("bgp")), + Route: models.ToPointer("advertised"), + Vrf: models.ToPointer("default"), } -apiResponse, err := utilitiesWAN.GetSiteSsrOspfInterface(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ShowSiteSsrAndSrxRoutes(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -597,40 +552,28 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr Ospf Neighbors +# Show Site Ssr and Srx Sessions -Get OSPF Neighbors from the Device. The output will be available through websocket. +Get active sessions passing through the Device. -As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. +The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. #### Subscribe to Device Command outputs `WS /api-ws/v1/stream` -```json -{ - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -} -``` +`json { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" }` #### Example output from ws stream -``` -===== ==================== ========== ======= ======== ================ =================== ================= -Vrf Neighbor Router ID Priority State Uptime Dead Timer Due Interface Address Interface State -===== ==================== ========== ======= ======== ================ =================== ================= - 1.0.0.3 1 Full 852 38 172.16.3.2 Backup - 1.0.0.4 1 Full 811 33 172.16.3.2 DROther - 1.0.0.3 1 Full 852 38 172.16.4.2 Backup - 1.0.0.4 1 Full 811 34 172.16.4.2 DROther -``` +`json { "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", "event": "data", "data": { "session": "f517bf29-1141-41ae-a084-17cacb0ccb57", "raw": "{\"status\":\"SUCCESS\",\"finished\":true,\"rows\":[{\"session_id\":\"a04b1cc7-dcc1-40a6-a010-0fe46ca38551\",\"direction\":\"forward\",\"service\":\"internet\",\"tenant\":\"SRV.PRD-Core\",\"device_interface\":\"ge-0/0/3\",\"network_interface\":\"ge-0/0/3.100\",\"protocol\":\"TCP\",\"source_ip\":\"10.3.20.101\",\"source_port\":45733,\"destination_ip\":\"13.38.46.35\",\"destination_port\":443,\"nat_ip\":\"192.168.1.115\",\"nat_port\":45256,\"payload_encrypted\":false,\"timeout\":1581,\"uptime\":319},{\"session_id\":\"a04b1cc7-dcc1-40a6-a010-0fe46ca38551\",\"direction\":\"reverse\",\"service\":\"internet\",\"tenant\":\"SRV.PRD-Core\",\"device_interface\":\"ge-0/0/0\",\"network_interface\":\"ge-0/0/0\",\"protocol\":\"TCP\",\"source_ip\":\"13.38.46.35\",\"source_port\":443,\"destination_ip\":\"192.168.1.115\",\"destination_port\":45256,\"nat_ip\":\"0.0.0.0\",\"nat_port\":0,\"payload_encrypted\":false,\"timeout\":1581,\"uptime\":319}]}\n" } }` ```go -GetSiteSsrOspfNeighbors( +ShowSiteSsrAndSrxSessions( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowOspfNeighbors) ( + body *models.UtilsShowSession) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -641,7 +584,7 @@ GetSiteSsrOspfNeighbors( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowOspfNeighbors`](../../doc/models/utils-show-ospf-neighbors.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsShowSession`](../../doc/models/utils-show-session.md) | Body, Optional | - | ## Response Type @@ -656,13 +599,12 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowOspfNeighbors{ - Neighbor: models.ToPointer("10.1.1.1"), - PortId: models.ToPointer("ge-0/0/3"), - Vrf: models.ToPointer("lan"), +body := models.UtilsShowSession{ + Node: models.ToPointer(models.HaClusterNodeEnum("node0")), + ServiceName: models.ToPointer("any"), } -apiResponse, err := utilitiesWAN.GetSiteSsrOspfNeighbors(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ShowSiteSsrAndSrxSessions(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -683,9 +625,9 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr Ospf Summary +# Show Site Ssr Ospf Database -Get OSPF summary from the Device. The output will be available through websocket. +Get OSPF Database from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. @@ -702,20 +644,21 @@ As there can be multiple command issued against the same device at the same time #### Example output from ws stream ``` -===== =========== ========== ============= ==================== ========= =========== ============= -Vrf Router ID ABR Type ASBR Router External LSA Count Area ID Area Type Area Border - Router -===== =========== ========== ============= ==================== ========= =========== ============= - 1.0.0.2 cisco False 0 0.0.0.0 - 1.0.0.2 cisco False 0 0.0.0.4 default +===== ==================== ========== ======= ======== ================ =================== ================= +Vrf Neighbor Router ID Priority State Uptime Dead Timer Due Interface Address Interface State +===== ==================== ========== ======= ======== ================ =================== ================= + 1.0.0.3 1 Full 852 38 172.16.3.2 Backup + 1.0.0.4 1 Full 811 33 172.16.3.2 DROther + 1.0.0.3 1 Full 852 38 172.16.4.2 Backup + 1.0.0.4 1 Full 811 34 172.16.4.2 DROther ``` ```go -GetSiteSsrOspfSummary( +ShowSiteSsrOspfDatabase( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowOspfSummary) ( + body *models.UtilsShowOspfDatabase) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -726,7 +669,7 @@ GetSiteSsrOspfSummary( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowOspfSummary`](../../doc/models/utils-show-ospf-summary.md) | Body, Optional | all attributes are optional | +| `body` | [`*models.UtilsShowOspfDatabase`](../../doc/models/utils-show-ospf-database.md) | Body, Optional | all attributes are optional | ## Response Type @@ -741,11 +684,12 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowOspfSummary{ - Vrf: models.ToPointer("lan"), +body := models.UtilsShowOspfDatabase{ + SelfOriginate: models.ToPointer(false), + Vrf: models.ToPointer("lan"), } -apiResponse, err := utilitiesWAN.GetSiteSsrOspfSummary(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ShowSiteSsrOspfDatabase(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -766,11 +710,11 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Get Site Ssr Service Path +# Show Site Ssr Ospf Interfaces -Get service path information of the Device. +Get OSPF interfaces from the Device. The output will be available through websocket. -The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. +As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. #### Subscribe to Device Command outputs @@ -778,32 +722,27 @@ The output will be available through websocket. As there can be multiple command ```json { - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" } ``` -##### Example output from ws stream +#### Example output from ws stream ``` -show service_path - -Service Service-route Type Destination Next-Hop Interface Vector Cost Rate Capacity State - -Web web-route1 service_agent 4.4.4.4 1.1.1.2 lan red 10 1 200/3000 Up* -Web web-route1 service_agent 4.4.4.4 1.1.1.3 lan red 10 1 200/3000 Up -Web web-route2 service_agent 5.5.5.5 2.2.2.2 lan blue 20 2 50/unlimited Down -Login BgpOverSVR 10.1.1.1 1.2.3.4 wan red 10 3 - Up -Login BgpOverSVR 11.1.1.1 1.2.3.4 wan red 10 1 - Up -App1 Routed - - - - - - - - -App1 learned-routed Routed - - - - - - - - +===== ================== =================== ============== =============== =========== ========= =========== +Vrf Device Interface Network Interface Interface Up IP Address OSPF Type Area ID Area Type +===== ================== =================== ============== =============== =========== ========= =========== + net1 g1 True 172.16.1.2/24 Broadcast 0.0.0.0 default + net3 g3 True 172.16.3.2/24 Broadcast 0.0.0.0 default + net4 g4 True 172.16.4.2/24 Broadcast 0.0.0.4 default ``` ```go -GetSiteSsrServicePath( +ShowSiteSsrOspfInterfaces( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsShowServicePath) ( + body *models.UtilsShowOspfInterfaces) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -814,7 +753,7 @@ GetSiteSsrServicePath( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsShowServicePath`](../../doc/models/utils-show-service-path.md) | Body, Optional | - | +| `body` | [`*models.UtilsShowOspfInterfaces`](../../doc/models/utils-show-ospf-interfaces.md) | Body, Optional | all attributes are optional | ## Response Type @@ -829,12 +768,12 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsShowServicePath{ - Node: models.ToPointer(models.HaClusterNodeEnum("node0")), - ServiceName: models.ToPointer("any"), +body := models.UtilsShowOspfInterfaces{ + PortId: models.ToPointer("ge-0/0/3"), + Vrf: models.ToPointer("lan"), } -apiResponse, err := utilitiesWAN.GetSiteSsrServicePath(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ShowSiteSsrOspfInterfaces(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -855,17 +794,41 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Release Site Ssr Dhcp Lease +# Show Site Ssr Ospf Neighbors -Releases an active DHCP lease. +Get OSPF Neighbors from the Device. The output will be available through websocket. + +As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. + +#### Subscribe to Device Command outputs + +`WS /api-ws/v1/stream` + +```json +{ + "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +} +``` + +#### Example output from ws stream + +``` +===== ==================== ========== ======= ======== ================ =================== ================= +Vrf Neighbor Router ID Priority State Uptime Dead Timer Due Interface Address Interface State +===== ==================== ========== ======= ======== ================ =================== ================= + 1.0.0.3 1 Full 852 38 172.16.3.2 Backup + 1.0.0.4 1 Full 811 33 172.16.3.2 DROther + 1.0.0.3 1 Full 852 38 172.16.4.2 Backup + 1.0.0.4 1 Full 811 34 172.16.4.2 DROther +``` ```go -ReleaseSiteSsrDhcpLease( +ShowSiteSsrOspfNeighbors( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsReleaseDhcp) ( - http.Response, + body *models.UtilsShowOspfNeighbors) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -875,11 +838,11 @@ ReleaseSiteSsrDhcpLease( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsReleaseDhcp`](../../doc/models/utils-release-dhcp.md) | Body, Optional | - | +| `body` | [`*models.UtilsShowOspfNeighbors`](../../doc/models/utils-show-ospf-neighbors.md) | Body, Optional | all attributes are optional | ## Response Type -`` +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -890,15 +853,19 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsReleaseDhcp{ - PortId: "ge-0/0/1.10", +body := models.UtilsShowOspfNeighbors{ + Neighbor: models.ToPointer("10.1.1.1"), + PortId: models.ToPointer("ge-0/0/3"), + Vrf: models.ToPointer("lan"), } -resp, err := utilitiesWAN.ReleaseSiteSsrDhcpLease(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ShowSiteSsrOspfNeighbors(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { - fmt.Println(resp.StatusCode) + // Printing the result and response + fmt.Println(apiResponse.Data) + fmt.Println(apiResponse.Response.StatusCode) } ``` @@ -906,16 +873,16 @@ if err != nil { | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | -| 400 | Parameter `port` absent | `ApiError` | +| 400 | Bad Syntax | [`ResponseHttp400Exception`](../../doc/models/response-http-400-exception.md) | | 401 | Unauthorized | [`ResponseHttp401ErrorException`](../../doc/models/response-http-401-error-exception.md) | | 403 | Permission Denied | [`ResponseHttp403ErrorException`](../../doc/models/response-http-403-error-exception.md) | | 404 | Not found. The API endpoint doesn’t exist or resource doesn’ t exist | [`ResponseHttp404Exception`](../../doc/models/response-http-404-exception.md) | | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Run Site Srx Top Command +# Show Site Ssr Ospf Summary -Run top command on switches and SRX. The output will be available through websocket. +Get OSPF summary from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. @@ -927,14 +894,26 @@ As there can be multiple command issued against the same device at the same time { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" } +``` + +#### Example output from ws stream + +``` +===== =========== ========== ============= ==================== ========= =========== ============= +Vrf Router ID ABR Type ASBR Router External LSA Count Area ID Area Type Area Border + Router +===== =========== ========== ============= ==================== ========= =========== ============= + 1.0.0.2 cisco False 0 0.0.0.0 + 1.0.0.2 cisco False 0 0.0.0.4 default ``` ```go -RunSiteSrxTopCommand( +ShowSiteSsrOspfSummary( ctx context.Context, siteId uuid.UUID, - deviceId uuid.UUID) ( - models.ApiResponse[models.WebsocketSessionWithUrl], + deviceId uuid.UUID, + body *models.UtilsShowOspfSummary) ( + models.ApiResponse[models.WebsocketSession], error) ``` @@ -944,10 +923,11 @@ RunSiteSrxTopCommand( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | +| `body` | [`*models.UtilsShowOspfSummary`](../../doc/models/utils-show-ospf-summary.md) | Body, Optional | all attributes are optional | ## Response Type -[`models.WebsocketSessionWithUrl`](../../doc/models/websocket-session-with-url.md) +[`models.WebsocketSession`](../../doc/models/websocket-session.md) ## Example Usage @@ -958,7 +938,11 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -apiResponse, err := utilitiesWAN.RunSiteSrxTopCommand(ctx, siteId, deviceId) +body := models.UtilsShowOspfSummary{ + Vrf: models.ToPointer("lan"), +} + +apiResponse, err := utilitiesWAN.ShowSiteSsrOspfSummary(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { @@ -979,41 +963,28 @@ if err != nil { | 429 | Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold | [`ResponseHttp429ErrorException`](../../doc/models/response-http-429-error-exception.md) | -# Service Ping From Ssr +# Show Site Ssr Service Path -Ping from SSR +Get service path information of the Device. -Service Ping can be performed from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. +The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. #### Subscribe to Device Command outputs `WS /api-ws/v1/stream` -```json -{ - "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -} -``` +`json { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" }` -##### Example output from ws stream +#### Example output from ws stream -```json -{ - "event": "data", - "channel": "/sites/4ac1dcf4-9d8b-7211-65c4-057819f0862b/devices/00000000-0000-0000-1000-5c5b350e0060/cmd", - "data": { - "session": "session_id", - "raw": "64 bytes from 23.211.0.110: seq=8 ttl=58 time=12.323 ms\n" - } -} -``` +`json { "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", "event": "data", "data": { "session":"5cb8a6db-d11a-42cd-bed7-19e9f29e637", "raw":"{\"status\":\"SUCCESS\",\"finished\":true,\"rows\":[{\"service\":\"management\",\"type\":\"service-agent\",\"network_interface\":\"ge-0/0/0\",\"destination\":\"\",\"gateway_ip\":\"192.168.1.1\",\"vector\":\"\",\"cost\":0,\"rate\":0,\"state\":\"Up\",\"capacity\":\"0/unlimited\",\"meetsSLA\":\"Yes\"},{\"service\":\"management\",\"type\":\"service-agent\",\"network_interface\":\"ge-0/0/1\",\"destination\":\"\",\"gateway_ip\":\"192.168.0.1\",\"vector\":\"\",\"cost\":0,\"rate\":0,\"state\":\"Up\",\"capacity\":\"0/unlimited\",\"meetsSLA\":\"Yes\"}]}" } }` ```go -ServicePingFromSsr( +ShowSiteSsrServicePath( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, - body *models.UtilsServicePing) ( + body *models.UtilsShowServicePath) ( models.ApiResponse[models.WebsocketSession], error) ``` @@ -1024,7 +995,7 @@ ServicePingFromSsr( | --- | --- | --- | --- | | `siteId` | `uuid.UUID` | Template, Required | - | | `deviceId` | `uuid.UUID` | Template, Required | - | -| `body` | [`*models.UtilsServicePing`](../../doc/models/utils-service-ping.md) | Body, Optional | Request Body | +| `body` | [`*models.UtilsShowServicePath`](../../doc/models/utils-show-service-path.md) | Body, Optional | - | ## Response Type @@ -1039,13 +1010,12 @@ siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") deviceId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab") -body := models.UtilsServicePing{ - Count: models.ToPointer(10), - Host: "1.1.1.1", - Service: "web-session", +body := models.UtilsShowServicePath{ + Node: models.ToPointer(models.HaClusterNodeEnum("node0")), + ServiceName: models.ToPointer("any"), } -apiResponse, err := utilitiesWAN.ServicePingFromSsr(ctx, siteId, deviceId, &body) +apiResponse, err := utilitiesWAN.ShowSiteSsrServicePath(ctx, siteId, deviceId, &body) if err != nil { log.Fatalln(err) } else { diff --git a/doc/models/avprofile-fallback-action-enum.md b/doc/models/avprofile-fallback-action-enum.md index 2be4ecdb..bdf46650 100644 --- a/doc/models/avprofile-fallback-action-enum.md +++ b/doc/models/avprofile-fallback-action-enum.md @@ -1,6 +1,8 @@ # Avprofile Fallback Action Enum +enum: `block`, `permit` + ## Enumeration `AvprofileFallbackActionEnum` @@ -9,6 +11,6 @@ | Name | | --- | -| `permit` | | `block` | +| `permit` | diff --git a/doc/models/avprofile-protocols-enum.md b/doc/models/avprofile-protocols-enum.md index 50848ff3..516baebc 100644 --- a/doc/models/avprofile-protocols-enum.md +++ b/doc/models/avprofile-protocols-enum.md @@ -1,6 +1,8 @@ # Avprofile Protocols Enum +enum: `ftp`, `http`, `imap`, `pop3`, `smtp` + ## Enumeration `AvprofileProtocolsEnum` diff --git a/doc/models/avprofile.md b/doc/models/avprofile.md index 6cb3f425..3c44b4dd 100644 --- a/doc/models/avprofile.md +++ b/doc/models/avprofile.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `CreatedTime` | `*float64` | Optional | - | -| `FallbackAction` | [`*models.AvprofileFallbackActionEnum`](../../doc/models/avprofile-fallback-action-enum.md) | Optional | - | +| `FallbackAction` | [`*models.AvprofileFallbackActionEnum`](../../doc/models/avprofile-fallback-action-enum.md) | Optional | enum: `block`, `permit` | | `Id` | `*uuid.UUID` | Optional | - | | `MexFilesize` | `*int` | Optional | in KB
**Constraints**: `>= 20`, `<= 40000` | | `MimeWhitelist` | `[]string` | Optional | **Constraints**: *Unique Items Required* | @@ -29,7 +29,7 @@ "org_id": "a97c1b22-a4e9-411e-9bfd-d8695a0f9e61", "site_id": "441a1214-6928-442a-8e92-e1d34b8ec6a6", "created_time": 49.94, - "fallback_action": "permit", + "fallback_action": "block", "id": "00001a6c-0000-0000-0000-000000000000", "mex_filesize": 94, "mime_whitelist": [ diff --git a/doc/models/client-wireless.md b/doc/models/client-wireless.md index d3ffe073..fed6329d 100644 --- a/doc/models/client-wireless.md +++ b/doc/models/client-wireless.md @@ -18,17 +18,17 @@ | `Hostname` | `[]string` | Optional | list of hostname detected for this client | | `Ip` | `[]string` | Optional | list if the ip addresses detected for this client | | `LastAp` | `*string` | Optional | latest AP where the client is/was connected to | -| `LastDevuce` | `*string` | Optional | latest type of device we identified (e.g. iPhone, Mac, …) | +| `LastDevice` | `*string` | Optional | latest type of device we identified (e.g. iPhone, Mac, …) | | `LastFirmware` | `*string` | Optional | only when client has the Marvis Client app running. Same as "firmware" | -| `LastHostname` | `*string` | Optional | lastest hostname we detected for the the client | -| `LastIp` | `*string` | Optional | lastest ip address we detected for the client | -| `LastModel` | `*string` | Optional | only when client has the Marvis Client app running. lastest client hardware model we detected for the client | +| `LastHostname` | `*string` | Optional | latest hostname we detected for the client | +| `LastIp` | `*string` | Optional | latest ip address we detected for the client | +| `LastModel` | `*string` | Optional | only when client has the Marvis Client app running. latest client hardware model we detected for the client | | `LastOs` | `*string` | Optional | only when client has the Marvis Client app running. Latest version of OS Type we detected for the client | | `LastOsVersion` | `*string` | Optional | only when client has the Marvis Client app running. Latest version of OS Version we detected for the client | | `LastPskId` | `*uuid.UUID` | Optional | only for PPSK authentication. Latest PPSK ID used by the client | | `LastPskName` | `*string` | Optional | only for PPSK authentication. Latest PPSK Name used by the client | -| `LastSsid` | `*string` | Optional | only for PPSK authentication. Latest PPSK Name used by the client | -| `LastUsername` | `*string` | Optional | only for 802.1X authentifcation. Latest username used by the client | +| `LastSsid` | `*string` | Optional | Name of the latest SSID (WLAN) the client is/was connected to client | +| `LastUsername` | `*string` | Optional | only for 802.1X authentication. Latest username used by the client | | `LastVlan` | `*int` | Optional | latest VLAN ID assigned to the client | | `LastWlanId` | `*uuid.UUID` | Optional | ID of the latest SSID (WLAN) the client is/was connected to | | `Mac` | `*string` | Optional | Client MAC Address | @@ -37,7 +37,7 @@ | `OrgId` | `*uuid.UUID` | Optional | Mist Org ID | | `Os` | `[]string` | Optional | only when client is having the Marvis Client app running. List of OS detected for the client | | `OsVersion` | `[]string` | Optional | only when client is having the Marvis Client app running. List of OS version detected for the client | -| `Protocol` | `*string` | Optional | 802.11 amendmant | +| `Protocol` | `*string` | Optional | 802.11 amendment | | `PskId` | `[]uuid.UUID` | Optional | list of IDs of the PPSK used by the client | | `PskName` | `[]string` | Optional | list of names of the PPSK used by the client | | `RandomMac` | `*bool` | Optional | whether the client is using randomized MAC Address or not | @@ -46,7 +46,7 @@ | `SiteIds` | `[]uuid.UUID` | Optional | list of Mist Site IDs where the client was connected | | `Ssid` | `[]string` | Optional | list of the WLAN names the client was connected to | | `Timestamp` | `*float64` | Optional | when the data has been updated | -| `Username` | `[]string` | Optional | only for 802.1X authentifcation. List of usernames used by the client | +| `Username` | `[]string` | Optional | only for 802.1X authentication. List of usernames used by the client | | `Vlan` | `[]int` | Optional | list of vlans that have been assigned to the client | | `WlanId` | `[]uuid.UUID` | Optional | list of IDs of WLANs the client was connected to | @@ -75,7 +75,7 @@ "192.168.0.2" ], "last_ap": "a83a79a947ee", - "last_devuce": "Mac", + "last_device": "Mac", "last_firmware": "wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675", "last_hostname": "hostname-a", "last_ip": "10.5.23.43", diff --git a/doc/models/guest-org.md b/doc/models/guest-org.md new file mode 100644 index 00000000..bb34f848 --- /dev/null +++ b/doc/models/guest-org.md @@ -0,0 +1,54 @@ + +# Guest Org + +Guest + +## Structure + +`GuestOrg` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `AccessCodeEmail` | `*string` | Optional | if `auth_method`==`email`, the email address where the authorization code has been sent to | +| `AllowWlanIdRoam` | `*bool` | Optional | based on the WLAN portal configuration (field `allow_wlan_id_roam`), if the user is also authorized on other Guest WLANs of the same Org without reauthentication | +| `ApMac` | `*string` | Optional | the MAC Address of the AP the guest was connected to during the registration process | +| `AuthMethod` | `*string` | Optional | type of guest authorization | +| `Authorized` | `*bool` | Optional | whether the guest is current authorized
**Default**: `true` | +| `AuthorizedExpiringTime` | `*float64` | Optional | when the authorization would expire | +| `AuthorizedTime` | `*float64` | Optional | when the guest was authorized | +| `Company` | `*string` | Optional | optional, the info provided by user | +| `CrossSite` | `*bool` | Optional | based on the WLAN portal configuration (field `cross_site`), if the user is also authorized on other sites (same `wlan.ssid`) of the same Org without reauthentication | +| `Email` | `*string` | Optional | optional, the info provided by user | +| `Field1` | `*string` | Optional | optional, the info provided by user | +| `Field2` | `*string` | Optional | - | +| `Field3` | `*string` | Optional | - | +| `Field4` | `*string` | Optional | - | +| `Mac` | `*string` | Optional | mac | +| `Minutes` | `*int` | Optional | Authorization duration, in minutes. Default is 1440 minutes (1 day), maximum is 259200 (180 days)
**Default**: `1440`
**Constraints**: `>= 0`, `<= 259200` | +| `Name` | `*string` | Optional | optional, the info provided by user | +| `RandomMac` | `*bool` | Optional | if the client is using a randomized MAC Address to connect the SSID | +| `Ssid` | `*string` | Optional | name of the SSID | +| `WlanId` | `uuid.UUID` | Required | ID of the WLAN | + +## Example (as JSON) + +```json +{ + "authorized": true, + "authorized_expiring_time": 1480704955, + "authorized_time": 1480704355, + "company": "abc", + "email": "john@abc.com", + "minutes": 1440, + "name": "John Smith", + "ssid": "Guest-SSID", + "wlan_id": "6748cfa6-4e12-11e6-9188-0242ac110007", + "access_code_email": "access_code_email8", + "allow_wlan_id_roam": false, + "ap_mac": "ap_mac8", + "auth_method": "auth_method0" +} +``` + diff --git a/doc/models/guest.md b/doc/models/guest.md index ba58b899..d3a76fa7 100644 --- a/doc/models/guest.md +++ b/doc/models/guest.md @@ -11,7 +11,10 @@ Guest | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `Authorized` | `*bool` | Optional | whether the guest is current authorized | +| `AccessCodeEmail` | `*string` | Optional | if `auth_method`==`email`, the email address where the authorization code has been sent to | +| `ApMac` | `*string` | Optional | the MAC Address of the AP the guest was connected to during the registration process | +| `AuthMethod` | `*string` | Optional | type of guest authorization | +| `Authorized` | `*bool` | Optional | whether the guest is current authorized
**Default**: `true` | | `AuthorizedExpiringTime` | `*float64` | Optional | when the authorization would expire | | `AuthorizedTime` | `*float64` | Optional | when the guest was authorized | | `Company` | `*string` | Optional | optional, the info provided by user | @@ -21,23 +24,28 @@ Guest | `Field3` | `*string` | Optional | - | | `Field4` | `*string` | Optional | - | | `Mac` | `*string` | Optional | mac | -| `Minutes` | `*int` | Optional | minutes, the maximum is 259200 (180 days) | +| `Minutes` | `*int` | Optional | Authorization duration, in minutes. Default is 1440 minutes (1 day), maximum is 259200 (180 days)
**Default**: `1440`
**Constraints**: `>= 0`, `<= 259200` | | `Name` | `*string` | Optional | optional, the info provided by user | -| `Ssid` | `*string` | Optional | - | -| `WlanId` | `*uuid.UUID` | Optional | - | +| `RandomMac` | `*bool` | Optional | if the client is using a randomized MAC Address to connect the SSID | +| `Ssid` | `*string` | Optional | name of the SSID | +| `WlanId` | `*uuid.UUID` | Optional | ID of the SSID | ## Example (as JSON) ```json { + "authorized": true, "authorized_expiring_time": 1480704955.0, - "authorized_time": 1480704355.0, + "authorized_time": 1480704355, "company": "abc", "email": "john@abc.com", + "minutes": 1440, "name": "John Smith", "ssid": "Guest-SSID", "wlan_id": "6748cfa6-4e12-11e6-9188-0242ac110007", - "authorized": false + "access_code_email": "access_code_email4", + "ap_mac": "ap_mac4", + "auth_method": "auth_method6" } ``` diff --git a/doc/models/idp-machine-cert-lookup-field-enum.md b/doc/models/idp-machine-cert-lookup-field-enum.md index da992e21..b75e3dde 100644 --- a/doc/models/idp-machine-cert-lookup-field-enum.md +++ b/doc/models/idp-machine-cert-lookup-field-enum.md @@ -1,7 +1,7 @@ # Idp Machine Cert Lookup Field Enum -allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup +allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup. enum: `automatic`, `cn`, `email`, `upn` ## Enumeration @@ -12,7 +12,7 @@ allow customer to choose the EAP-TLS client certificate's field to use for IDP M | Name | | --- | | `automatic` | +| `cn` | | `email` | | `upn` | -| `cn` | diff --git a/doc/models/idp-user-cert-lookup-field-enum.md b/doc/models/idp-user-cert-lookup-field-enum.md index 1a483422..f7b0344d 100644 --- a/doc/models/idp-user-cert-lookup-field-enum.md +++ b/doc/models/idp-user-cert-lookup-field-enum.md @@ -1,7 +1,8 @@ # Idp User Cert Lookup Field Enum -allow customer to choose the EAP-TLS client certificate's field to use for IDP User Groups lookup +allow customer to choose the EAP-TLS client certificate's field +to use for IDP User Groups lookup. enum: `automatic`, `cn`, `email`, `upn` ## Enumeration @@ -12,7 +13,7 @@ allow customer to choose the EAP-TLS client certificate's field to use for IDP U | Name | | --- | | `automatic` | +| `cn` | | `email` | | `upn` | -| `cn` | diff --git a/doc/models/inventory.md b/doc/models/inventory.md index e0eacbad..ed141e54 100644 --- a/doc/models/inventory.md +++ b/doc/models/inventory.md @@ -27,7 +27,7 @@ | `SiteId` | `*uuid.UUID` | Optional | - | | `Sku` | `*string` | Optional | device stock keeping unit | | `Type` | [`*models.DeviceTypeEnum`](../../doc/models/device-type-enum.md) | Optional | enum: `ap`, `gateway`, `switch`
**Default**: `"ap"` | -| `VcMac` | `*string` | Optional | only if `type`==`switch`, MAC Address of the Virtual Chassis | +| `VcMac` | `*string` | Optional | if `type`==`switch` and device part of a Virtual Chassis, MAC Address of the Virtual Chassis. if `type`==`gateway` and device part of a Clust, MAC Address of the Cluster | ## Example (as JSON) diff --git a/doc/models/nac-portal-sso-idp-sign-algo-enum.md b/doc/models/nac-portal-sso-idp-sign-algo-enum.md index 70cf1e66..d5816d97 100644 --- a/doc/models/nac-portal-sso-idp-sign-algo-enum.md +++ b/doc/models/nac-portal-sso-idp-sign-algo-enum.md @@ -1,7 +1,7 @@ # Nac Portal Sso Idp Sign Algo Enum -Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. ## Enumeration diff --git a/doc/models/nac-portal-sso.md b/doc/models/nac-portal-sso.md index 9a8b3514..39e1b8f0 100644 --- a/doc/models/nac-portal-sso.md +++ b/doc/models/nac-portal-sso.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `IdpCert` | `*string` | Optional | - | -| `IdpSignAlgo` | [`*models.NacPortalSsoIdpSignAlgoEnum`](../../doc/models/nac-portal-sso-idp-sign-algo-enum.md) | Optional | Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512`
**Default**: `"sha256"` | +| `IdpSignAlgo` | [`*models.NacPortalSsoIdpSignAlgoEnum`](../../doc/models/nac-portal-sso-idp-sign-algo-enum.md) | Optional | Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`.
**Default**: `"sha256"` | | `IdpSsoUrl` | `*string` | Optional | - | | `Issuer` | `*string` | Optional | - | | `NameidFormat` | `*string` | Optional | - | diff --git a/doc/models/nac-portal-type-enum.md b/doc/models/nac-portal-type-enum.md index 690d8a49..204da810 100644 --- a/doc/models/nac-portal-type-enum.md +++ b/doc/models/nac-portal-type-enum.md @@ -1,6 +1,8 @@ # Nac Portal Type Enum +enum: `guest`, `marvis_client` + ## Enumeration `NacPortalTypeEnum` @@ -9,6 +11,6 @@ | Name | | --- | -| `marvis_client` | | `guest` | +| `marvis_client` | diff --git a/doc/models/nac-portal.md b/doc/models/nac-portal.md index d1a04df1..b3600f03 100644 --- a/doc/models/nac-portal.md +++ b/doc/models/nac-portal.md @@ -23,7 +23,7 @@ | `TemplateUrl` | `*string` | Optional | - | | `ThumbnailUrl` | `*string` | Optional | - | | `Tos` | `*string` | Optional | - | -| `Type` | [`*models.NacPortalTypeEnum`](../../doc/models/nac-portal-type-enum.md) | Optional | - | +| `Type` | [`*models.NacPortalTypeEnum`](../../doc/models/nac-portal-type-enum.md) | Optional | enum: `guest`, `marvis_client` | ## Example (as JSON) diff --git a/doc/models/nac-tag-username-attr-enum.md b/doc/models/nac-tag-username-attr-enum.md index 0c7cddaf..a5cfd507 100644 --- a/doc/models/nac-tag-username-attr-enum.md +++ b/doc/models/nac-tag-username-attr-enum.md @@ -1,6 +1,8 @@ # Nac Tag Username Attr Enum +enum: `automatic`, `cn`, `dns`, `email`, `upn` + ## Enumeration `NacTagUsernameAttrEnum` @@ -11,7 +13,7 @@ | --- | | `automatic` | | `cn` | -| `upn` | -| `email` | | `dns` | +| `email` | +| `upn` | diff --git a/doc/models/nac-tag.md b/doc/models/nac-tag.md index 4e386732..51fac935 100644 --- a/doc/models/nac-tag.md +++ b/doc/models/nac-tag.md @@ -24,7 +24,7 @@ | `RadiusVendorAttrs` | `[]string` | Optional | if `type`==`radius_vendor_attrs`, user can specify a list of one or more vendor-specific attributes in the field "radius_vendor_attrs".
It is the responsibility of the user to provide a syntactically correct string, otherwise it may not work as expected.
Note that it is allowed to have more than one radius_vendor_attrs in the result of a given rule. | | `SessionTimeout` | `*int` | Optional | if `type`==`session_timeout, in seconds | | `Type` | [`models.NacTagTypeEnum`](../../doc/models/nac-tag-type-enum.md) | Required | enum: `egress_vlan_names`, `gbp_tag`, `match`, `radius_attrs`, `radius_group`, `radius_vendor_attrs`, `session_timeout`, `username_attr`, `vlan`
**Constraints**: *Minimum Length*: `1` | -| `UsernameAttr` | [`*models.NacTagUsernameAttrEnum`](../../doc/models/nac-tag-username-attr-enum.md) | Optional | - | +| `UsernameAttr` | [`*models.NacTagUsernameAttrEnum`](../../doc/models/nac-tag-username-attr-enum.md) | Optional | enum: `automatic`, `cn`, `dns`, `email`, `upn` | | `Values` | `[]string` | Optional | if `type`==`match` | | `Vlan` | `*string` | Optional | if `type`==`vlan` | diff --git a/doc/models/org-service-policy-ssl-proxy.md b/doc/models/org-service-policy-ssl-proxy.md index 8b0bce92..427a0b42 100644 --- a/doc/models/org-service-policy-ssl-proxy.md +++ b/doc/models/org-service-policy-ssl-proxy.md @@ -11,7 +11,7 @@ for SRX-only | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `CiphersCatagory` | [`*models.SslProxyCiphersCatagoryEnum`](../../doc/models/ssl-proxy-ciphers-catagory-enum.md) | Optional | **Default**: `"strong"` | +| `CiphersCatagory` | [`*models.SslProxyCiphersCatagoryEnum`](../../doc/models/ssl-proxy-ciphers-catagory-enum.md) | Optional | enum: `medium`, `strong`, `weak`
**Default**: `"strong"` | | `Enabled` | `*bool` | Optional | **Default**: `false` | ## Example (as JSON) diff --git a/doc/models/org-setting-mist-nac.md b/doc/models/org-setting-mist-nac.md index 84d61c38..cea153e6 100644 --- a/doc/models/org-setting-mist-nac.md +++ b/doc/models/org-setting-mist-nac.md @@ -14,8 +14,8 @@ | `DisableRsaeAlgorithms` | `*bool` | Optional | to disable RSAE_PSS_SHA256, RSAE_PSS_SHA384, RSAE_PSS_SHA512 from server side. see https://www.openssl.org/docs/man3.0/man1/openssl-ciphers.html
**Default**: `false` | | `EapSslSecurityLevel` | `*int` | Optional | eap ssl security level
see https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_security_level.html#DEFAULT-CALLBACK-BEHAVIOUR
**Default**: `2`
**Constraints**: `>= 1`, `<= 4` | | `EuOnly` | `*bool` | Optional | By default NAC POD failover considers all NAC pods available around the globe, i.e. EU, US, or APAC based, failover happens based on geo IP of the originating site.
For strict GDPR compliancy NAC POD failover would only happen between the PODs located within the EU environment, and no authentication would take place outside of EU. This is an org setting that is applicable to WLANs, switch templates, mxedge clusters that have mist_nac enabled
**Default**: `false` | -| `IdpMachineCertLookupField` | [`*models.IdpMachineCertLookupFieldEnum`](../../doc/models/idp-machine-cert-lookup-field-enum.md) | Optional | allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup
**Default**: `"automatic"` | -| `IdpUserCertLookupField` | [`*models.IdpUserCertLookupFieldEnum`](../../doc/models/idp-user-cert-lookup-field-enum.md) | Optional | allow customer to choose the EAP-TLS client certificate's field to use for IDP User Groups lookup
**Default**: `"automatic"` | +| `IdpMachineCertLookupField` | [`*models.IdpMachineCertLookupFieldEnum`](../../doc/models/idp-machine-cert-lookup-field-enum.md) | Optional | allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup. enum: `automatic`, `cn`, `email`, `upn`
**Default**: `"automatic"` | +| `IdpUserCertLookupField` | [`*models.IdpUserCertLookupFieldEnum`](../../doc/models/idp-user-cert-lookup-field-enum.md) | Optional | allow customer to choose the EAP-TLS client certificate's field
to use for IDP User Groups lookup. enum: `automatic`, `cn`, `email`, `upn`
**Default**: `"automatic"` | | `Idps` | [`[]models.OrgSettingMistNacIdp`](../../doc/models/org-setting-mist-nac-idp.md) | Optional | - | | `ServerCert` | [`*models.OrgSettingMistNacServerCert`](../../doc/models/org-setting-mist-nac-server-cert.md) | Optional | radius server cert to be presented in EAP TLS | | `UseIpVersion` | [`*models.OrgSettingMistNacIpVersionEnum`](../../doc/models/org-setting-mist-nac-ip-version-enum.md) | Optional | by default NAS devices(switches/aps) and proxies(mxedge) are configured to reach mist-nac via IPv4. enum: `v4`, `v6`
**Default**: `"v4"` | diff --git a/doc/models/psk-portal-sso-idp-sign-algo-enum.md b/doc/models/psk-portal-sso-idp-sign-algo-enum.md index b5c232f1..4fd6e2c0 100644 --- a/doc/models/psk-portal-sso-idp-sign-algo-enum.md +++ b/doc/models/psk-portal-sso-idp-sign-algo-enum.md @@ -1,7 +1,7 @@ # Psk Portal Sso Idp Sign Algo Enum -Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. enum: `sha1`, `sha256`, `sha384`, `sha512` ## Enumeration diff --git a/doc/models/psk-portal-sso.md b/doc/models/psk-portal-sso.md index 50326a0e..669fe6d9 100644 --- a/doc/models/psk-portal-sso.md +++ b/doc/models/psk-portal-sso.md @@ -13,7 +13,7 @@ if `auth`==`sso` | --- | --- | --- | --- | | `AllowedRoles` | `[]string` | Optional | // allowed roles for accessing psk portal, if none, any role is permitted | | `IdpCert` | `*string` | Optional | - | -| `IdpSignAlgo` | [`*models.PskPortalSsoIdpSignAlgoEnum`](../../doc/models/psk-portal-sso-idp-sign-algo-enum.md) | Optional | Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512`
**Default**: `"sha256"` | +| `IdpSignAlgo` | [`*models.PskPortalSsoIdpSignAlgoEnum`](../../doc/models/psk-portal-sso-idp-sign-algo-enum.md) | Optional | Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. enum: `sha1`, `sha256`, `sha384`, `sha512`
**Default**: `"sha256"` | | `IdpSsoUrl` | `*string` | Optional | - | | `Issuer` | `*string` | Optional | - | | `NameidFormat` | `*string` | Optional | - | diff --git a/doc/models/response-client-search.md b/doc/models/response-client-search.md index 12963dfc..7f5689b0 100644 --- a/doc/models/response-client-search.md +++ b/doc/models/response-client-search.md @@ -45,7 +45,7 @@ "192.168.0.2" ], "last_ap": "a83a79a947ee", - "last_devuce": "Mac", + "last_device": "Mac", "last_firmware": "wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675", "last_hostname": "hostname-a", "last_ip": "10.5.23.43", diff --git a/doc/models/response-guest-search.md b/doc/models/response-guest-search.md index fd6e134d..983b612f 100644 --- a/doc/models/response-guest-search.md +++ b/doc/models/response-guest-search.md @@ -25,14 +25,18 @@ "next": "next0", "results": [ { + "authorized": true, "authorized_expiring_time": 1480704955.0, - "authorized_time": 1480704355.0, + "authorized_time": 1480704355, "company": "abc", "email": "john@abc.com", + "minutes": 1440, "name": "John Smith", "ssid": "Guest-SSID", "wlan_id": "6748cfa6-4e12-11e6-9188-0242ac110007", - "authorized": false + "access_code_email": "access_code_email8", + "ap_mac": "ap_mac8", + "auth_method": "auth_method0" } ], "start": 124, diff --git a/doc/models/secintel-profile-profile-category-enum.md b/doc/models/secintel-profile-profile-category-enum.md index 60b160ae..c01c0a42 100644 --- a/doc/models/secintel-profile-profile-category-enum.md +++ b/doc/models/secintel-profile-profile-category-enum.md @@ -12,6 +12,6 @@ enum: `CC`, `IH` (Infected Host), `DNS` | Name | | --- | | `CC` | -| `IH` | | `DNS` | +| `IH` | diff --git a/doc/models/secintel-profile-profile.md b/doc/models/secintel-profile-profile.md index 59403893..65af9ae2 100644 --- a/doc/models/secintel-profile-profile.md +++ b/doc/models/secintel-profile-profile.md @@ -17,7 +17,7 @@ ```json { "action": "default", - "category": "DNS" + "category": "IH" } ``` diff --git a/doc/models/secintel-profile.md b/doc/models/secintel-profile.md index 2f4c176f..ce8f08cc 100644 --- a/doc/models/secintel-profile.md +++ b/doc/models/secintel-profile.md @@ -20,11 +20,11 @@ "profiles": [ { "action": "strict", - "category": "DNS" + "category": "IH" }, { "action": "strict", - "category": "DNS" + "category": "IH" } ] } diff --git a/doc/models/ssl-proxy-ciphers-catagory-enum.md b/doc/models/ssl-proxy-ciphers-catagory-enum.md index 16337b54..ab55e44d 100644 --- a/doc/models/ssl-proxy-ciphers-catagory-enum.md +++ b/doc/models/ssl-proxy-ciphers-catagory-enum.md @@ -1,6 +1,8 @@ # Ssl Proxy Ciphers Catagory Enum +enum: `medium`, `strong`, `weak` + ## Enumeration `SslProxyCiphersCatagoryEnum` @@ -9,7 +11,7 @@ | Name | | --- | -| `strong` | | `medium` | +| `strong` | | `weak` | diff --git a/doc/models/sso-idp-sign-algo-enum.md b/doc/models/sso-idp-sign-algo-enum.md index ea6968b0..624cafb3 100644 --- a/doc/models/sso-idp-sign-algo-enum.md +++ b/doc/models/sso-idp-sign-algo-enum.md @@ -1,7 +1,7 @@ # Sso Idp Sign Algo Enum -Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` ## Enumeration diff --git a/doc/models/sso.md b/doc/models/sso.md index 692939d6..eac48fd9 100644 --- a/doc/models/sso.md +++ b/doc/models/sso.md @@ -18,7 +18,7 @@ SSO | `GroupFilter` | `*string` | Optional | Required if `ldap_type`==`custom`, LDAP filter that will identify the type of group | | `Id` | `*uuid.UUID` | Optional | - | | `IdpCert` | `*string` | Optional | if `idp_type`==`saml`. IDP Cert (used to verify the signed response) | -| `IdpSignAlgo` | [`*models.SsoIdpSignAlgoEnum`](../../doc/models/sso-idp-sign-algo-enum.md) | Optional | Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` | +| `IdpSignAlgo` | [`*models.SsoIdpSignAlgoEnum`](../../doc/models/sso-idp-sign-algo-enum.md) | Optional | Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` | | `IdpSsoUrl` | `*string` | Optional | Required if `idp_type`==`saml`, IDP Single-Sign-On URL | | `IdpType` | [`*models.SsoIdpTypeEnum`](../../doc/models/sso-idp-type-enum.md) | Optional | * For Admin SSO, enum: `saml`
* For NAC SSO, enum: `ldap`, `mxedge_proxy`, `oauth`
**Default**: `"saml"` | | `IgnoreUnmatchedRoles` | `*bool` | Optional | if `idp_type`==`saml`, ignore any unmatched roles provided in assertion. By default, an assertion is treated as invalid for any unmatched role | diff --git a/doc/models/stats-site.md b/doc/models/stats-site.md index a1d29d0d..1e63ca60 100644 --- a/doc/models/stats-site.md +++ b/doc/models/stats-site.md @@ -12,7 +12,7 @@ Site statistics | Name | Type | Tags | Description | | --- | --- | --- | --- | | `Address` | `string` | Required | - | -| `AlarmtemplateId` | `uuid.UUID` | Required | - | +| `AlarmtemplateId` | `*uuid.UUID` | Required | - | | `CountryCode` | `string` | Required | - | | `CreatedTime` | `float64` | Required | - | | `Id` | `uuid.UUID` | Required | - | @@ -20,9 +20,9 @@ Site statistics | `Latlng` | [`models.LatLng`](../../doc/models/lat-lng.md) | Required | - | | `Lng` | `float64` | Required | - | | `ModifiedTime` | `float64` | Required | - | -| `MspId` | `string` | Required | - | +| `MspId` | `*uuid.UUID` | Required | - | | `Name` | `string` | Required | - | -| `NetworktemplateId` | `uuid.UUID` | Required | - | +| `NetworktemplateId` | `*uuid.UUID` | Required | - | | `NumAp` | `int` | Required | - | | `NumApConnected` | `int` | Required | - | | `NumClients` | `int` | Required | - | @@ -33,8 +33,8 @@ Site statistics | `NumSwitch` | `int` | Required | - | | `NumSwitchConnected` | `int` | Required | - | | `OrgId` | `uuid.UUID` | Required | - | -| `RftemplateId` | `uuid.UUID` | Required | - | -| `SecpolicyId` | `*interface{}` | Optional | - | +| `RftemplateId` | `*uuid.UUID` | Required | - | +| `SecpolicyId` | `models.Optional[uuid.UUID]` | Optional | - | | `SitegroupIds` | `[]uuid.UUID` | Required | - | | `Timezone` | `string` | Required | - | | `Tzoffset` | `int` | Required | - | @@ -55,7 +55,7 @@ Site statistics }, "lng": 239.82, "modified_time": 31.1, - "msp_id": "msp_id0", + "msp_id": "00000668-0000-0000-0000-000000000000", "name": "name6", "networktemplate_id": "000001e2-0000-0000-0000-000000000000", "num_ap": 224, @@ -75,10 +75,7 @@ Site statistics ], "timezone": "timezone6", "tzoffset": 240, - "secpolicy_id": { - "key1": "val1", - "key2": "val2" - } + "secpolicy_id": "0000247e-0000-0000-0000-000000000000" } ``` diff --git a/doc/models/stats-wrule-action-enum.md b/doc/models/stats-wxrule-action-enum.md similarity index 62% rename from doc/models/stats-wrule-action-enum.md rename to doc/models/stats-wxrule-action-enum.md index ac47cb0d..5bdd0c25 100644 --- a/doc/models/stats-wrule-action-enum.md +++ b/doc/models/stats-wxrule-action-enum.md @@ -1,11 +1,11 @@ -# Stats Wrule Action Enum +# Stats Wxrule Action Enum enum: `allow`, `block` ## Enumeration -`StatsWruleActionEnum` +`StatsWxruleActionEnum` ## Fields diff --git a/doc/models/stats-wrule-usage-properties.md b/doc/models/stats-wxrule-usage-properties.md similarity index 62% rename from doc/models/stats-wrule-usage-properties.md rename to doc/models/stats-wxrule-usage-properties.md index 00ddfe7d..9ff0e74c 100644 --- a/doc/models/stats-wrule-usage-properties.md +++ b/doc/models/stats-wxrule-usage-properties.md @@ -1,9 +1,9 @@ -# Stats Wrule Usage Properties +# Stats Wxrule Usage Properties ## Structure -`StatsWruleUsageProperties` +`StatsWxruleUsageProperties` ## Fields @@ -15,7 +15,7 @@ ```json { - "num_flows": 54 + "num_flows": 210 } ``` diff --git a/doc/models/stats-wrule.md b/doc/models/stats-wxrule.md similarity index 77% rename from doc/models/stats-wrule.md rename to doc/models/stats-wxrule.md index 0ce9dd9f..6c4acad1 100644 --- a/doc/models/stats-wrule.md +++ b/doc/models/stats-wxrule.md @@ -1,17 +1,17 @@ -# Stats Wrule +# Stats Wxrule Wxrule statistics ## Structure -`StatsWrule` +`StatsWxrule` ## Fields | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `Action` | [`models.StatsWruleActionEnum`](../../doc/models/stats-wrule-action-enum.md) | Required | enum: `allow`, `block` | +| `Action` | [`models.StatsWxruleActionEnum`](../../doc/models/stats-wxrule-action-enum.md) | Required | enum: `allow`, `block` | | `ClientMac` | `[]string` | Required | - | | `DstAllowWxtags` | `[]uuid.UUID` | Required | - | | `DstDenyWxtags` | `[]uuid.UUID` | Required | - | @@ -19,7 +19,7 @@ Wxrule statistics | `Name` | `string` | Required | - | | `Order` | `int` | Required | - | | `SrcWxtags` | `[]uuid.UUID` | Required | - | -| `Usage` | [`map[string]models.StatsWruleUsageProperties`](../../doc/models/stats-wrule-usage-properties.md) | Required | - | +| `Usage` | [`map[string]models.StatsWxruleUsageProperties`](../../doc/models/stats-wxrule-usage-properties.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/synthetictest-device-protocol-enum.md b/doc/models/synthetictest-device-protocol-enum.md index 9eb8f146..67bd6088 100644 --- a/doc/models/synthetictest-device-protocol-enum.md +++ b/doc/models/synthetictest-device-protocol-enum.md @@ -12,6 +12,6 @@ if `type`==`lan_connectivity`. enum: `ping`, `traceroute`, `ping+traceroute` | Name | | --- | | `ping` | -| `traceroute` | | `ping+traceroute` | +| `traceroute` | diff --git a/doc/models/tunnel-configs-dh-group-enum.md b/doc/models/tunnel-configs-dh-group-enum.md index 834dbe8a..919554fa 100644 --- a/doc/models/tunnel-configs-dh-group-enum.md +++ b/doc/models/tunnel-configs-dh-group-enum.md @@ -23,13 +23,13 @@ Only if `provider`== `custom-ipsec`. enum: | Name | | --- | | `1` | -| `2` | -| `5` | | `14` | | `15` | | `16` | | `19` | +| `2` | | `20` | | `21` | | `24` | +| `5` | diff --git a/doc/models/utils-show-dhcp-leases.md b/doc/models/utils-show-dhcp-leases.md index 6d814c48..e0385efc 100644 --- a/doc/models/utils-show-dhcp-leases.md +++ b/doc/models/utils-show-dhcp-leases.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `Network` | `*string` | Optional | DHCP network for the leases, returns full table if not specified | +| `Network` | `string` | Required | DHCP network for the leases, returns full table if not specified | | `Node` | [`*models.HaClusterNodeEnum`](../../doc/models/ha-cluster-node-enum.md) | Optional | only for HA. enum: `node0`, `node1` | ## Example (as JSON) diff --git a/doc/models/webhook-topic-enum.md b/doc/models/webhook-topic-enum.md index d82a077b..b4a92e52 100644 --- a/doc/models/webhook-topic-enum.md +++ b/doc/models/webhook-topic-enum.md @@ -19,8 +19,8 @@ enum: `alarms`, `asset-raw`, `asset-raw-rssi`, `audits`, `client-info`, `client- | `client-join` | | `client-latency` | | `client-sessions` | -| `device-updowns` | | `device-events` | +| `device-updowns` | | `discovered-raw-rssi` | | `location` | | `location_asset` | diff --git a/doc/models/wlan-portal-idp-sign-algo-enum.md b/doc/models/wlan-portal-idp-sign-algo-enum.md index 4a3f3d40..7bc1114e 100644 --- a/doc/models/wlan-portal-idp-sign-algo-enum.md +++ b/doc/models/wlan-portal-idp-sign-algo-enum.md @@ -1,7 +1,7 @@ # Wlan Portal Idp Sign Algo Enum -if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` ## Enumeration diff --git a/doc/models/wlan-portal.md b/doc/models/wlan-portal.md index 6e2593af..d94416fa 100644 --- a/doc/models/wlan-portal.md +++ b/doc/models/wlan-portal.md @@ -11,6 +11,7 @@ portal wlan settings | Name | Type | Tags | Description | | --- | --- | --- | --- | +| `AllowWlanIdRoam` | `*bool` | Optional | whether to allow guest to connect to other Guest WLANs (with different `WLAN.ssid`) of same org without reauthentication (disable random_mac for seamless roaming)
**Default**: `false` | | `AmazonClientId` | `models.Optional[string]` | Optional | amazon OAuth2 client id. This is optional. If not provided, it will use a default one. | | `AmazonClientSecret` | `models.Optional[string]` | Optional | amazon OAuth2 client secret. If amazon_client_id was provided, provide a correspoinding value. Else leave blank. | | `AmazonEmailDomains` | `[]string` | Optional | Matches authenticated user email against provided domains. If null or [], all authenticated emails will be allowed. | @@ -75,7 +76,7 @@ portal wlan settings | `SsoDefaultRole` | `*string` | Optional | if `wlan_portal_auth`==`sso`, default role to assign if there’s no match. By default, an assertion is treated as invalid when there’s no role matched | | `SsoForcedRole` | `*string` | Optional | if `wlan_portal_auth`==`sso` | | `SsoIdpCert` | `*string` | Optional | if `wlan_portal_auth`==`sso`, IDP Cert (used to verify the signed response) | -| `SsoIdpSignAlgo` | [`*models.WlanPortalIdpSignAlgoEnum`](../../doc/models/wlan-portal-idp-sign-algo-enum.md) | Optional | if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512`
**Default**: `"sha1"` | +| `SsoIdpSignAlgo` | [`*models.WlanPortalIdpSignAlgoEnum`](../../doc/models/wlan-portal-idp-sign-algo-enum.md) | Optional | if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`
**Default**: `"sha1"` | | `SsoIdpSsoUrl` | `*string` | Optional | if `wlan_portal_auth`==`sso`, IDP Single-Sign-On URL | | `SsoIssuer` | `*string` | Optional | if `wlan_portal_auth`==`sso`, IDP issuer URL | | `SsoNameidFormat` | [`*models.WlanPortalSsoNameidFormatEnum`](../../doc/models/wlan-portal-sso-nameid-format-enum.md) | Optional | if `wlan_portal_auth`==`sso`. enum: `email`, `unspecified`
**Default**: `"email"` | @@ -89,6 +90,7 @@ portal wlan settings ```json { + "allow_wlan_id_roam": false, "amazon_email_domains": [ "amazon_email_domains4", "amazon_email_domains5", @@ -139,8 +141,7 @@ portal wlan settings "twilio_phone_number": "+18548888888", "twilio_sid": "AC72ec6ba0ec5af30e6731c5e47abcdefgh", "amazon_client_id": "amazon_client_id4", - "amazon_client_secret": "amazon_client_secret0", - "amazon_expire": 137.94 + "amazon_client_secret": "amazon_client_secret0" } ``` diff --git a/doc/models/wlan-roam-mode-enum.md b/doc/models/wlan-roam-mode-enum.md index 64fdbd87..8af08e9b 100644 --- a/doc/models/wlan-roam-mode-enum.md +++ b/doc/models/wlan-roam-mode-enum.md @@ -12,8 +12,8 @@ enum: `11r`, `OKC`, `NONE` | Name | | --- | | `11r` | -| `OKC` | | `NONE` | +| `OKC` | ## Example diff --git a/doc/models/wxlan-rule.md b/doc/models/wxlan-rule.md index d0d65bbe..a6ea1c91 100644 --- a/doc/models/wxlan-rule.md +++ b/doc/models/wxlan-rule.md @@ -22,7 +22,7 @@ WXlan | `ForSite` | `*bool` | Optional | - | | `Id` | `*uuid.UUID` | Optional | - | | `ModifiedTime` | `*float64` | Optional | - | -| `Order` | `int` | Required | the order how rules would be looked up, > 0 and bigger order got matched first, -1 means LAST, uniqueness not checked
**Constraints**: `>= 1` | +| `Order` | `int` | Required | the order how rules would be looked up, > 0 and bigger order got matched first, -1 means LAST, uniqueness not checked
**Constraints**: `>= -1` | | `OrgId` | `*uuid.UUID` | Optional | - | | `SiteId` | `*uuid.UUID` | Optional | - | | `SrcWxtags` | `[]string` | Required | List of WxTag UUID to determine if this rule would match | diff --git a/mistapi/client.go b/mistapi/client.go index 61b32098..3bf48005 100644 --- a/mistapi/client.go +++ b/mistapi/client.go @@ -83,6 +83,7 @@ type ClientInterface interface { OrgsStatsMxEdges() *OrgsStatsMxEdges OrgsStatsOtherDevices() *OrgsStatsOtherDevices OrgsStatsPorts() *OrgsStatsPorts + OrgsStatsSites() *OrgsStatsSites OrgsStatsTunnels() *OrgsStatsTunnels OrgsStatsVPNPeers() *OrgsStatsVPNPeers OrgsNACRules() *OrgsNACRules @@ -281,6 +282,7 @@ type client struct { orgsStatsMxEdges OrgsStatsMxEdges orgsStatsOtherDevices OrgsStatsOtherDevices orgsStatsPorts OrgsStatsPorts + orgsStatsSites OrgsStatsSites orgsStatsTunnels OrgsStatsTunnels orgsStatsVPNPeers OrgsStatsVPNPeers orgsNACRules OrgsNACRules @@ -408,7 +410,7 @@ func NewClient(configuration Configuration) ClientInterface { configuration: configuration, } - client.userAgent = utilities.UpdateUserAgent("SDK 2409.1.9") + client.userAgent = utilities.UpdateUserAgent("SDK 2409.1.11") client.callBuilderFactory = callBuilderHandler( func(server string) string { if server == "" { @@ -497,6 +499,7 @@ func NewClient(configuration Configuration) ClientInterface { client.orgsStatsMxEdges = *NewOrgsStatsMxEdges(*baseController) client.orgsStatsOtherDevices = *NewOrgsStatsOtherDevices(*baseController) client.orgsStatsPorts = *NewOrgsStatsPorts(*baseController) + client.orgsStatsSites = *NewOrgsStatsSites(*baseController) client.orgsStatsTunnels = *NewOrgsStatsTunnels(*baseController) client.orgsStatsVPNPeers = *NewOrgsStatsVPNPeers(*baseController) client.orgsNACRules = *NewOrgsNACRules(*baseController) @@ -988,6 +991,11 @@ func (c *client) OrgsStatsPorts() *OrgsStatsPorts { return &c.orgsStatsPorts } +// OrgsStatsSites returns the orgsStatsSites instance of the client. +func (c *client) OrgsStatsSites() *OrgsStatsSites { + return &c.orgsStatsSites +} + // OrgsStatsTunnels returns the orgsStatsTunnels instance of the client. func (c *client) OrgsStatsTunnels() *OrgsStatsTunnels { return &c.orgsStatsTunnels diff --git a/mistapi/models/avprofile.go b/mistapi/models/avprofile.go index da1ab959..0acaa4c4 100644 --- a/mistapi/models/avprofile.go +++ b/mistapi/models/avprofile.go @@ -10,6 +10,7 @@ import ( // Avprofile represents a Avprofile struct. type Avprofile struct { CreatedTime *float64 `json:"created_time,omitempty"` + // enum: `block`, `permit` FallbackAction *AvprofileFallbackActionEnum `json:"fallback_action,omitempty"` Id *uuid.UUID `json:"id,omitempty"` // in KB diff --git a/mistapi/models/client_wireless.go b/mistapi/models/client_wireless.go index 6f6daf98..6c093cac 100644 --- a/mistapi/models/client_wireless.go +++ b/mistapi/models/client_wireless.go @@ -25,14 +25,14 @@ type ClientWireless struct { // latest AP where the client is/was connected to LastAp *string `json:"last_ap,omitempty"` // latest type of device we identified (e.g. iPhone, Mac, …) - LastDevuce *string `json:"last_devuce,omitempty"` + LastDevice *string `json:"last_device,omitempty"` // only when client has the Marvis Client app running. Same as "firmware" LastFirmware *string `json:"last_firmware,omitempty"` - // lastest hostname we detected for the the client + // latest hostname we detected for the client LastHostname *string `json:"last_hostname,omitempty"` - // lastest ip address we detected for the client + // latest ip address we detected for the client LastIp *string `json:"last_ip,omitempty"` - // only when client has the Marvis Client app running. lastest client hardware model we detected for the client + // only when client has the Marvis Client app running. latest client hardware model we detected for the client LastModel *string `json:"last_model,omitempty"` // only when client has the Marvis Client app running. Latest version of OS Type we detected for the client LastOs *string `json:"last_os,omitempty"` @@ -42,9 +42,9 @@ type ClientWireless struct { LastPskId *uuid.UUID `json:"last_psk_id,omitempty"` // only for PPSK authentication. Latest PPSK Name used by the client LastPskName *string `json:"last_psk_name,omitempty"` - // only for PPSK authentication. Latest PPSK Name used by the client + // Name of the latest SSID (WLAN) the client is/was connected to client LastSsid *string `json:"last_ssid,omitempty"` - // only for 802.1X authentifcation. Latest username used by the client + // only for 802.1X authentication. Latest username used by the client LastUsername *string `json:"last_username,omitempty"` // latest VLAN ID assigned to the client LastVlan *int `json:"last_vlan,omitempty"` @@ -62,7 +62,7 @@ type ClientWireless struct { Os []string `json:"os,omitempty"` // only when client is having the Marvis Client app running. List of OS version detected for the client OsVersion []string `json:"os_version,omitempty"` - // 802.11 amendmant + // 802.11 amendment Protocol *string `json:"protocol,omitempty"` // list of IDs of the PPSK used by the client PskId []uuid.UUID `json:"psk_id,omitempty"` @@ -80,7 +80,7 @@ type ClientWireless struct { Ssid []string `json:"ssid,omitempty"` // when the data has been updated Timestamp *float64 `json:"timestamp,omitempty"` - // only for 802.1X authentifcation. List of usernames used by the client + // only for 802.1X authentication. List of usernames used by the client Username []string `json:"username,omitempty"` // list of vlans that have been assigned to the client Vlan []int `json:"vlan,omitempty"` @@ -128,8 +128,8 @@ func (c ClientWireless) toMap() map[string]any { if c.LastAp != nil { structMap["last_ap"] = c.LastAp } - if c.LastDevuce != nil { - structMap["last_devuce"] = c.LastDevuce + if c.LastDevice != nil { + structMap["last_device"] = c.LastDevice } if c.LastFirmware != nil { structMap["last_firmware"] = c.LastFirmware @@ -232,7 +232,7 @@ func (c *ClientWireless) UnmarshalJSON(input []byte) error { if err != nil { return err } - additionalProperties, err := UnmarshalAdditionalProperties(input, "ap", "app_version", "band", "device", "ftc", "hardware", "hostname", "ip", "last_ap", "last_devuce", "last_firmware", "last_hostname", "last_ip", "last_model", "last_os", "last_os_version", "last_psk_id", "last_psk_name", "last_ssid", "last_username", "last_vlan", "last_wlan_id", "mac", "mfg", "model", "org_id", "os", "os_version", "protocol", "psk_id", "psk_name", "random_mac", "sdk_version", "site_id", "site_ids", "ssid", "timestamp", "username", "vlan", "wlan_id") + additionalProperties, err := UnmarshalAdditionalProperties(input, "ap", "app_version", "band", "device", "ftc", "hardware", "hostname", "ip", "last_ap", "last_device", "last_firmware", "last_hostname", "last_ip", "last_model", "last_os", "last_os_version", "last_psk_id", "last_psk_name", "last_ssid", "last_username", "last_vlan", "last_wlan_id", "mac", "mfg", "model", "org_id", "os", "os_version", "protocol", "psk_id", "psk_name", "random_mac", "sdk_version", "site_id", "site_ids", "ssid", "timestamp", "username", "vlan", "wlan_id") if err != nil { return err } @@ -247,7 +247,7 @@ func (c *ClientWireless) UnmarshalJSON(input []byte) error { c.Hostname = temp.Hostname c.Ip = temp.Ip c.LastAp = temp.LastAp - c.LastDevuce = temp.LastDevuce + c.LastDevice = temp.LastDevice c.LastFirmware = temp.LastFirmware c.LastHostname = temp.LastHostname c.LastIp = temp.LastIp @@ -292,7 +292,7 @@ type tempClientWireless struct { Hostname []string `json:"hostname,omitempty"` Ip []string `json:"ip,omitempty"` LastAp *string `json:"last_ap,omitempty"` - LastDevuce *string `json:"last_devuce,omitempty"` + LastDevice *string `json:"last_device,omitempty"` LastFirmware *string `json:"last_firmware,omitempty"` LastHostname *string `json:"last_hostname,omitempty"` LastIp *string `json:"last_ip,omitempty"` diff --git a/mistapi/models/enums.go b/mistapi/models/enums.go index ecec4a39..63099829 100644 --- a/mistapi/models/enums.go +++ b/mistapi/models/enums.go @@ -221,14 +221,16 @@ const ( ) // AvprofileFallbackActionEnum is a string enum. +// enum: `block`, `permit` type AvprofileFallbackActionEnum string const ( - AvprofileFallbackActionEnum_PERMIT AvprofileFallbackActionEnum = "permit" AvprofileFallbackActionEnum_BLOCK AvprofileFallbackActionEnum = "block" + AvprofileFallbackActionEnum_PERMIT AvprofileFallbackActionEnum = "permit" ) // AvprofileProtocolsEnum is a string enum. +// enum: `ftp`, `http`, `imap`, `pop3`, `smtp` type AvprofileProtocolsEnum string const ( @@ -1146,14 +1148,14 @@ const ( ) // IdpMachineCertLookupFieldEnum is a string enum. -// allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup +// allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup. enum: `automatic`, `cn`, `email`, `upn` type IdpMachineCertLookupFieldEnum string const ( IdpMachineCertLookupFieldEnum_AUTOMATIC IdpMachineCertLookupFieldEnum = "automatic" + IdpMachineCertLookupFieldEnum_CN IdpMachineCertLookupFieldEnum = "cn" IdpMachineCertLookupFieldEnum_EMAIL IdpMachineCertLookupFieldEnum = "email" IdpMachineCertLookupFieldEnum_UPN IdpMachineCertLookupFieldEnum = "upn" - IdpMachineCertLookupFieldEnum_CN IdpMachineCertLookupFieldEnum = "cn" ) // IdpProfileActionEnum is a string enum. @@ -1191,14 +1193,15 @@ const ( ) // IdpUserCertLookupFieldEnum is a string enum. -// allow customer to choose the EAP-TLS client certificate's field to use for IDP User Groups lookup +// allow customer to choose the EAP-TLS client certificate's field +// to use for IDP User Groups lookup. enum: `automatic`, `cn`, `email`, `upn` type IdpUserCertLookupFieldEnum string const ( IdpUserCertLookupFieldEnum_AUTOMATIC IdpUserCertLookupFieldEnum = "automatic" + IdpUserCertLookupFieldEnum_CN IdpUserCertLookupFieldEnum = "cn" IdpUserCertLookupFieldEnum_EMAIL IdpUserCertLookupFieldEnum = "email" IdpUserCertLookupFieldEnum_UPN IdpUserCertLookupFieldEnum = "upn" - IdpUserCertLookupFieldEnum_CN IdpUserCertLookupFieldEnum = "cn" ) // ImportSiteAssetsUpsertEnum is a string enum. @@ -1658,7 +1661,7 @@ const ( ) // NacPortalSsoIdpSignAlgoEnum is a string enum. -// Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +// Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. type NacPortalSsoIdpSignAlgoEnum string const ( @@ -1669,11 +1672,12 @@ const ( ) // NacPortalTypeEnum is a string enum. +// enum: `guest`, `marvis_client` type NacPortalTypeEnum string const ( - NacPortalTypeEnum_MARVISCLIENT NacPortalTypeEnum = "marvis_client" NacPortalTypeEnum_GUEST NacPortalTypeEnum = "guest" + NacPortalTypeEnum_MARVISCLIENT NacPortalTypeEnum = "marvis_client" ) // NacRuleActionEnum is a string enum. @@ -1749,14 +1753,15 @@ const ( ) // NacTagUsernameAttrEnum is a string enum. +// enum: `automatic`, `cn`, `dns`, `email`, `upn` type NacTagUsernameAttrEnum string const ( NacTagUsernameAttrEnum_AUTOMATIC NacTagUsernameAttrEnum = "automatic" NacTagUsernameAttrEnum_CN NacTagUsernameAttrEnum = "cn" - NacTagUsernameAttrEnum_UPN NacTagUsernameAttrEnum = "upn" - NacTagUsernameAttrEnum_EMAIL NacTagUsernameAttrEnum = "email" NacTagUsernameAttrEnum_DNS NacTagUsernameAttrEnum = "dns" + NacTagUsernameAttrEnum_EMAIL NacTagUsernameAttrEnum = "email" + NacTagUsernameAttrEnum_UPN NacTagUsernameAttrEnum = "upn" ) // OauthAppNameEnum is a string enum. @@ -2283,7 +2288,7 @@ const ( ) // PskPortalSsoIdpSignAlgoEnum is a string enum. -// Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +// Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. enum: `sha1`, `sha256`, `sha384`, `sha512` type PskPortalSsoIdpSignAlgoEnum string const ( @@ -2706,8 +2711,8 @@ type SecintelProfileProfileCategoryEnum string const ( SecintelProfileProfileCategoryEnum_CC SecintelProfileProfileCategoryEnum = "CC" - SecintelProfileProfileCategoryEnum_IH SecintelProfileProfileCategoryEnum = "IH" SecintelProfileProfileCategoryEnum_DNS SecintelProfileProfileCategoryEnum = "DNS" + SecintelProfileProfileCategoryEnum_IH SecintelProfileProfileCategoryEnum = "IH" ) // ServiceFailoverPolicyEnum is a string enum. @@ -3428,16 +3433,17 @@ const ( ) // SslProxyCiphersCatagoryEnum is a string enum. +// enum: `medium`, `strong`, `weak` type SslProxyCiphersCatagoryEnum string const ( - SslProxyCiphersCatagoryEnum_STRONG SslProxyCiphersCatagoryEnum = "strong" SslProxyCiphersCatagoryEnum_MEDIUM SslProxyCiphersCatagoryEnum = "medium" + SslProxyCiphersCatagoryEnum_STRONG SslProxyCiphersCatagoryEnum = "strong" SslProxyCiphersCatagoryEnum_WEAK SslProxyCiphersCatagoryEnum = "weak" ) // SsoIdpSignAlgoEnum is a string enum. -// Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +// Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` type SsoIdpSignAlgoEnum string const ( @@ -3610,13 +3616,13 @@ const ( StatsWanTunnelPriorityEnum_SECONDARY StatsWanTunnelPriorityEnum = "secondary" ) -// StatsWruleActionEnum is a string enum. +// StatsWxruleActionEnum is a string enum. // enum: `allow`, `block` -type StatsWruleActionEnum string +type StatsWxruleActionEnum string const ( - StatsWruleActionEnum_ALLOW StatsWruleActionEnum = "allow" - StatsWruleActionEnum_BLOCK StatsWruleActionEnum = "block" + StatsWxruleActionEnum_ALLOW StatsWxruleActionEnum = "allow" + StatsWxruleActionEnum_BLOCK StatsWxruleActionEnum = "block" ) // SuppressedAlarmScopeEnum is a string enum. @@ -3736,8 +3742,8 @@ type SynthetictestDeviceProtocolEnum string const ( SynthetictestDeviceProtocolEnum_PING SynthetictestDeviceProtocolEnum = "ping" - SynthetictestDeviceProtocolEnum_TRACEROUTE SynthetictestDeviceProtocolEnum = "traceroute" SynthetictestDeviceProtocolEnum_ENUMPINGTRACEROUTE SynthetictestDeviceProtocolEnum = "ping+traceroute" + SynthetictestDeviceProtocolEnum_TRACEROUTE SynthetictestDeviceProtocolEnum = "traceroute" ) // SynthetictestInfoDeviceTypeEnum is a string enum. @@ -3827,15 +3833,15 @@ type TunnelConfigsDhGroupEnum string const ( TunnelConfigsDhGroupEnum_ENUM1 TunnelConfigsDhGroupEnum = "1" - TunnelConfigsDhGroupEnum_ENUM2 TunnelConfigsDhGroupEnum = "2" - TunnelConfigsDhGroupEnum_ENUM5 TunnelConfigsDhGroupEnum = "5" TunnelConfigsDhGroupEnum_ENUM14 TunnelConfigsDhGroupEnum = "14" TunnelConfigsDhGroupEnum_ENUM15 TunnelConfigsDhGroupEnum = "15" TunnelConfigsDhGroupEnum_ENUM16 TunnelConfigsDhGroupEnum = "16" TunnelConfigsDhGroupEnum_ENUM19 TunnelConfigsDhGroupEnum = "19" + TunnelConfigsDhGroupEnum_ENUM2 TunnelConfigsDhGroupEnum = "2" TunnelConfigsDhGroupEnum_ENUM20 TunnelConfigsDhGroupEnum = "20" TunnelConfigsDhGroupEnum_ENUM21 TunnelConfigsDhGroupEnum = "21" TunnelConfigsDhGroupEnum_ENUM24 TunnelConfigsDhGroupEnum = "24" + TunnelConfigsDhGroupEnum_ENUM5 TunnelConfigsDhGroupEnum = "5" ) // TunnelConfigsEncAlgoEnum is a string enum. @@ -4170,8 +4176,8 @@ const ( WebhookTopicEnum_CLIENTJOIN WebhookTopicEnum = "client-join" WebhookTopicEnum_CLIENTLATENCY WebhookTopicEnum = "client-latency" WebhookTopicEnum_CLIENTSESSIONS WebhookTopicEnum = "client-sessions" - WebhookTopicEnum_DEVICEUPDOWNS WebhookTopicEnum = "device-updowns" WebhookTopicEnum_DEVICEEVENTS WebhookTopicEnum = "device-events" + WebhookTopicEnum_DEVICEUPDOWNS WebhookTopicEnum = "device-updowns" WebhookTopicEnum_DISCOVEREDRAWRSSI WebhookTopicEnum = "discovered-raw-rssi" WebhookTopicEnum_LOCATION WebhookTopicEnum = "location" WebhookTopicEnum_LOCATIONASSET WebhookTopicEnum = "location_asset" @@ -4365,7 +4371,7 @@ const ( ) // WlanPortalIdpSignAlgoEnum is a string enum. -// if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` +// if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` type WlanPortalIdpSignAlgoEnum string const ( @@ -4415,8 +4421,8 @@ type WlanRoamModeEnum string const ( WlanRoamModeEnum_ENUM11R WlanRoamModeEnum = "11r" - WlanRoamModeEnum_OKC WlanRoamModeEnum = "OKC" WlanRoamModeEnum_NONE WlanRoamModeEnum = "NONE" + WlanRoamModeEnum_OKC WlanRoamModeEnum = "OKC" ) // WxlanRuleActionEnum is a string enum. diff --git a/mistapi/models/guest.go b/mistapi/models/guest.go index efcb4606..e57ea7f7 100644 --- a/mistapi/models/guest.go +++ b/mistapi/models/guest.go @@ -8,6 +8,12 @@ import ( // Guest represents a Guest struct. // Guest type Guest struct { + // if `auth_method`==`email`, the email address where the authorization code has been sent to + AccessCodeEmail *string `json:"access_code_email,omitempty"` + // the MAC Address of the AP the guest was connected to during the registration process + ApMac *string `json:"ap_mac,omitempty"` + // type of guest authorization + AuthMethod *string `json:"auth_method,omitempty"` // whether the guest is current authorized Authorized *bool `json:"authorized,omitempty"` // when the authorization would expire @@ -25,11 +31,15 @@ type Guest struct { Field4 *string `json:"field4,omitempty"` // mac Mac *string `json:"mac,omitempty"` - // minutes, the maximum is 259200 (180 days) + // Authorization duration, in minutes. Default is 1440 minutes (1 day), maximum is 259200 (180 days) Minutes *int `json:"minutes,omitempty"` // optional, the info provided by user Name *string `json:"name,omitempty"` + // if the client is using a randomized MAC Address to connect the SSID + RandomMac *bool `json:"random_mac,omitempty"` + // name of the SSID Ssid *string `json:"ssid,omitempty"` + // ID of the SSID WlanId *uuid.UUID `json:"wlan_id,omitempty"` AdditionalProperties map[string]any `json:"_"` } @@ -46,6 +56,15 @@ func (g Guest) MarshalJSON() ( func (g Guest) toMap() map[string]any { structMap := make(map[string]any) MapAdditionalProperties(structMap, g.AdditionalProperties) + if g.AccessCodeEmail != nil { + structMap["access_code_email"] = g.AccessCodeEmail + } + if g.ApMac != nil { + structMap["ap_mac"] = g.ApMac + } + if g.AuthMethod != nil { + structMap["auth_method"] = g.AuthMethod + } if g.Authorized != nil { structMap["authorized"] = g.Authorized } @@ -82,6 +101,9 @@ func (g Guest) toMap() map[string]any { if g.Name != nil { structMap["name"] = g.Name } + if g.RandomMac != nil { + structMap["random_mac"] = g.RandomMac + } if g.Ssid != nil { structMap["ssid"] = g.Ssid } @@ -99,12 +121,15 @@ func (g *Guest) UnmarshalJSON(input []byte) error { if err != nil { return err } - additionalProperties, err := UnmarshalAdditionalProperties(input, "authorized", "authorized_expiring_time", "authorized_time", "company", "email", "field1", "field2", "field3", "field4", "mac", "minutes", "name", "ssid", "wlan_id") + additionalProperties, err := UnmarshalAdditionalProperties(input, "access_code_email", "ap_mac", "auth_method", "authorized", "authorized_expiring_time", "authorized_time", "company", "email", "field1", "field2", "field3", "field4", "mac", "minutes", "name", "random_mac", "ssid", "wlan_id") if err != nil { return err } g.AdditionalProperties = additionalProperties + g.AccessCodeEmail = temp.AccessCodeEmail + g.ApMac = temp.ApMac + g.AuthMethod = temp.AuthMethod g.Authorized = temp.Authorized g.AuthorizedExpiringTime = temp.AuthorizedExpiringTime g.AuthorizedTime = temp.AuthorizedTime @@ -117,6 +142,7 @@ func (g *Guest) UnmarshalJSON(input []byte) error { g.Mac = temp.Mac g.Minutes = temp.Minutes g.Name = temp.Name + g.RandomMac = temp.RandomMac g.Ssid = temp.Ssid g.WlanId = temp.WlanId return nil @@ -124,6 +150,9 @@ func (g *Guest) UnmarshalJSON(input []byte) error { // tempGuest is a temporary struct used for validating the fields of Guest. type tempGuest struct { + AccessCodeEmail *string `json:"access_code_email,omitempty"` + ApMac *string `json:"ap_mac,omitempty"` + AuthMethod *string `json:"auth_method,omitempty"` Authorized *bool `json:"authorized,omitempty"` AuthorizedExpiringTime *float64 `json:"authorized_expiring_time,omitempty"` AuthorizedTime *float64 `json:"authorized_time,omitempty"` @@ -136,6 +165,7 @@ type tempGuest struct { Mac *string `json:"mac,omitempty"` Minutes *int `json:"minutes,omitempty"` Name *string `json:"name,omitempty"` + RandomMac *bool `json:"random_mac,omitempty"` Ssid *string `json:"ssid,omitempty"` WlanId *uuid.UUID `json:"wlan_id,omitempty"` } diff --git a/mistapi/models/guest_org.go b/mistapi/models/guest_org.go new file mode 100644 index 00000000..c532ae85 --- /dev/null +++ b/mistapi/models/guest_org.go @@ -0,0 +1,200 @@ +package models + +import ( + "encoding/json" + "errors" + "github.com/google/uuid" + "strings" +) + +// GuestOrg represents a GuestOrg struct. +// Guest +type GuestOrg struct { + // if `auth_method`==`email`, the email address where the authorization code has been sent to + AccessCodeEmail *string `json:"access_code_email,omitempty"` + // based on the WLAN portal configuration (field `allow_wlan_id_roam`), if the user is also authorized on other Guest WLANs of the same Org without reauthentication + AllowWlanIdRoam *bool `json:"allow_wlan_id_roam,omitempty"` + // the MAC Address of the AP the guest was connected to during the registration process + ApMac *string `json:"ap_mac,omitempty"` + // type of guest authorization + AuthMethod *string `json:"auth_method,omitempty"` + // whether the guest is current authorized + Authorized *bool `json:"authorized,omitempty"` + // when the authorization would expire + AuthorizedExpiringTime *float64 `json:"authorized_expiring_time,omitempty"` + // when the guest was authorized + AuthorizedTime *float64 `json:"authorized_time,omitempty"` + // optional, the info provided by user + Company *string `json:"company,omitempty"` + // based on the WLAN portal configuration (field `cross_site`), if the user is also authorized on other sites (same `wlan.ssid`) of the same Org without reauthentication + CrossSite *bool `json:"cross_site,omitempty"` + // optional, the info provided by user + Email *string `json:"email,omitempty"` + // optional, the info provided by user + Field1 *string `json:"field1,omitempty"` + Field2 *string `json:"field2,omitempty"` + Field3 *string `json:"field3,omitempty"` + Field4 *string `json:"field4,omitempty"` + // mac + Mac *string `json:"mac,omitempty"` + // Authorization duration, in minutes. Default is 1440 minutes (1 day), maximum is 259200 (180 days) + Minutes *int `json:"minutes,omitempty"` + // optional, the info provided by user + Name *string `json:"name,omitempty"` + // if the client is using a randomized MAC Address to connect the SSID + RandomMac *bool `json:"random_mac,omitempty"` + // name of the SSID + Ssid *string `json:"ssid,omitempty"` + // ID of the WLAN + WlanId uuid.UUID `json:"wlan_id"` + AdditionalProperties map[string]any `json:"_"` +} + +// MarshalJSON implements the json.Marshaler interface for GuestOrg. +// It customizes the JSON marshaling process for GuestOrg objects. +func (g GuestOrg) MarshalJSON() ( + []byte, + error) { + return json.Marshal(g.toMap()) +} + +// toMap converts the GuestOrg object to a map representation for JSON marshaling. +func (g GuestOrg) toMap() map[string]any { + structMap := make(map[string]any) + MapAdditionalProperties(structMap, g.AdditionalProperties) + if g.AccessCodeEmail != nil { + structMap["access_code_email"] = g.AccessCodeEmail + } + if g.AllowWlanIdRoam != nil { + structMap["allow_wlan_id_roam"] = g.AllowWlanIdRoam + } + if g.ApMac != nil { + structMap["ap_mac"] = g.ApMac + } + if g.AuthMethod != nil { + structMap["auth_method"] = g.AuthMethod + } + if g.Authorized != nil { + structMap["authorized"] = g.Authorized + } + if g.AuthorizedExpiringTime != nil { + structMap["authorized_expiring_time"] = g.AuthorizedExpiringTime + } + if g.AuthorizedTime != nil { + structMap["authorized_time"] = g.AuthorizedTime + } + if g.Company != nil { + structMap["company"] = g.Company + } + if g.CrossSite != nil { + structMap["cross_site"] = g.CrossSite + } + if g.Email != nil { + structMap["email"] = g.Email + } + if g.Field1 != nil { + structMap["field1"] = g.Field1 + } + if g.Field2 != nil { + structMap["field2"] = g.Field2 + } + if g.Field3 != nil { + structMap["field3"] = g.Field3 + } + if g.Field4 != nil { + structMap["field4"] = g.Field4 + } + if g.Mac != nil { + structMap["mac"] = g.Mac + } + if g.Minutes != nil { + structMap["minutes"] = g.Minutes + } + if g.Name != nil { + structMap["name"] = g.Name + } + if g.RandomMac != nil { + structMap["random_mac"] = g.RandomMac + } + if g.Ssid != nil { + structMap["ssid"] = g.Ssid + } + structMap["wlan_id"] = g.WlanId + return structMap +} + +// UnmarshalJSON implements the json.Unmarshaler interface for GuestOrg. +// It customizes the JSON unmarshaling process for GuestOrg objects. +func (g *GuestOrg) UnmarshalJSON(input []byte) error { + var temp tempGuestOrg + err := json.Unmarshal(input, &temp) + if err != nil { + return err + } + err = temp.validate() + if err != nil { + return err + } + additionalProperties, err := UnmarshalAdditionalProperties(input, "access_code_email", "allow_wlan_id_roam", "ap_mac", "auth_method", "authorized", "authorized_expiring_time", "authorized_time", "company", "cross_site", "email", "field1", "field2", "field3", "field4", "mac", "minutes", "name", "random_mac", "ssid", "wlan_id") + if err != nil { + return err + } + + g.AdditionalProperties = additionalProperties + g.AccessCodeEmail = temp.AccessCodeEmail + g.AllowWlanIdRoam = temp.AllowWlanIdRoam + g.ApMac = temp.ApMac + g.AuthMethod = temp.AuthMethod + g.Authorized = temp.Authorized + g.AuthorizedExpiringTime = temp.AuthorizedExpiringTime + g.AuthorizedTime = temp.AuthorizedTime + g.Company = temp.Company + g.CrossSite = temp.CrossSite + g.Email = temp.Email + g.Field1 = temp.Field1 + g.Field2 = temp.Field2 + g.Field3 = temp.Field3 + g.Field4 = temp.Field4 + g.Mac = temp.Mac + g.Minutes = temp.Minutes + g.Name = temp.Name + g.RandomMac = temp.RandomMac + g.Ssid = temp.Ssid + g.WlanId = *temp.WlanId + return nil +} + +// tempGuestOrg is a temporary struct used for validating the fields of GuestOrg. +type tempGuestOrg struct { + AccessCodeEmail *string `json:"access_code_email,omitempty"` + AllowWlanIdRoam *bool `json:"allow_wlan_id_roam,omitempty"` + ApMac *string `json:"ap_mac,omitempty"` + AuthMethod *string `json:"auth_method,omitempty"` + Authorized *bool `json:"authorized,omitempty"` + AuthorizedExpiringTime *float64 `json:"authorized_expiring_time,omitempty"` + AuthorizedTime *float64 `json:"authorized_time,omitempty"` + Company *string `json:"company,omitempty"` + CrossSite *bool `json:"cross_site,omitempty"` + Email *string `json:"email,omitempty"` + Field1 *string `json:"field1,omitempty"` + Field2 *string `json:"field2,omitempty"` + Field3 *string `json:"field3,omitempty"` + Field4 *string `json:"field4,omitempty"` + Mac *string `json:"mac,omitempty"` + Minutes *int `json:"minutes,omitempty"` + Name *string `json:"name,omitempty"` + RandomMac *bool `json:"random_mac,omitempty"` + Ssid *string `json:"ssid,omitempty"` + WlanId *uuid.UUID `json:"wlan_id"` +} + +func (g *tempGuestOrg) validate() error { + var errs []string + if g.WlanId == nil { + errs = append(errs, "required field `wlan_id` is missing for type `guest_org`") + } + if len(errs) == 0 { + return nil + } + return errors.New(strings.Join (errs, "\n")) +} diff --git a/mistapi/models/inventory.go b/mistapi/models/inventory.go index 94096267..ce78f8ea 100644 --- a/mistapi/models/inventory.go +++ b/mistapi/models/inventory.go @@ -41,7 +41,7 @@ type Inventory struct { Sku *string `json:"sku,omitempty"` // enum: `ap`, `gateway`, `switch` Type *DeviceTypeEnum `json:"type,omitempty"` - // only if `type`==`switch`, MAC Address of the Virtual Chassis + // if `type`==`switch` and device part of a Virtual Chassis, MAC Address of the Virtual Chassis. if `type`==`gateway` and device part of a Clust, MAC Address of the Cluster VcMac *string `json:"vc_mac,omitempty"` AdditionalProperties map[string]any `json:"_"` } diff --git a/mistapi/models/nac_portal.go b/mistapi/models/nac_portal.go index bbcfa24c..07c663f3 100644 --- a/mistapi/models/nac_portal.go +++ b/mistapi/models/nac_portal.go @@ -28,6 +28,7 @@ type NacPortal struct { TemplateUrl *string `json:"template_url,omitempty"` ThumbnailUrl *string `json:"thumbnail_url,omitempty"` Tos *string `json:"tos,omitempty"` + // enum: `guest`, `marvis_client` Type *NacPortalTypeEnum `json:"type,omitempty"` AdditionalProperties map[string]any `json:"_"` } diff --git a/mistapi/models/nac_portal_sso.go b/mistapi/models/nac_portal_sso.go index 259af5b5..022871b8 100644 --- a/mistapi/models/nac_portal_sso.go +++ b/mistapi/models/nac_portal_sso.go @@ -7,7 +7,7 @@ import ( // NacPortalSso represents a NacPortalSso struct. type NacPortalSso struct { IdpCert *string `json:"idp_cert,omitempty"` - // Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` + // Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. IdpSignAlgo *NacPortalSsoIdpSignAlgoEnum `json:"idp_sign_algo,omitempty"` IdpSsoUrl *string `json:"idp_sso_url,omitempty"` Issuer *string `json:"issuer,omitempty"` diff --git a/mistapi/models/nac_tag.go b/mistapi/models/nac_tag.go index 3cdcd7b6..e767fce7 100644 --- a/mistapi/models/nac_tag.go +++ b/mistapi/models/nac_tag.go @@ -41,6 +41,7 @@ type NacTag struct { SessionTimeout *int `json:"session_timeout,omitempty"` // enum: `egress_vlan_names`, `gbp_tag`, `match`, `radius_attrs`, `radius_group`, `radius_vendor_attrs`, `session_timeout`, `username_attr`, `vlan` Type NacTagTypeEnum `json:"type"` + // enum: `automatic`, `cn`, `dns`, `email`, `upn` UsernameAttr *NacTagUsernameAttrEnum `json:"username_attr,omitempty"` // if `type`==`match` Values []string `json:"values,omitempty"` diff --git a/mistapi/models/org_service_policy_ssl_proxy.go b/mistapi/models/org_service_policy_ssl_proxy.go index c39437dc..ff141f3d 100644 --- a/mistapi/models/org_service_policy_ssl_proxy.go +++ b/mistapi/models/org_service_policy_ssl_proxy.go @@ -7,6 +7,7 @@ import ( // OrgServicePolicySslProxy represents a OrgServicePolicySslProxy struct. // for SRX-only type OrgServicePolicySslProxy struct { + // enum: `medium`, `strong`, `weak` CiphersCatagory *SslProxyCiphersCatagoryEnum `json:"ciphers_catagory,omitempty"` Enabled *bool `json:"enabled,omitempty"` AdditionalProperties map[string]any `json:"_"` diff --git a/mistapi/models/org_setting_mist_nac.go b/mistapi/models/org_setting_mist_nac.go index 89a08714..59fbfefa 100644 --- a/mistapi/models/org_setting_mist_nac.go +++ b/mistapi/models/org_setting_mist_nac.go @@ -18,9 +18,10 @@ type OrgSettingMistNac struct { // By default NAC POD failover considers all NAC pods available around the globe, i.e. EU, US, or APAC based, failover happens based on geo IP of the originating site. // For strict GDPR compliancy NAC POD failover would only happen between the PODs located within the EU environment, and no authentication would take place outside of EU. This is an org setting that is applicable to WLANs, switch templates, mxedge clusters that have mist_nac enabled EuOnly *bool `json:"eu_only,omitempty"` - // allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup + // allow customer to choose the EAP-TLS client certificate's field to use for IDP Machine Groups lookup. enum: `automatic`, `cn`, `email`, `upn` IdpMachineCertLookupField *IdpMachineCertLookupFieldEnum `json:"idp_machine_cert_lookup_field,omitempty"` - // allow customer to choose the EAP-TLS client certificate's field to use for IDP User Groups lookup + // allow customer to choose the EAP-TLS client certificate's field + // to use for IDP User Groups lookup. enum: `automatic`, `cn`, `email`, `upn` IdpUserCertLookupField *IdpUserCertLookupFieldEnum `json:"idp_user_cert_lookup_field,omitempty"` Idps []OrgSettingMistNacIdp `json:"idps,omitempty"` // radius server cert to be presented in EAP TLS diff --git a/mistapi/models/psk_portal_sso.go b/mistapi/models/psk_portal_sso.go index b5c1199a..edd0acbb 100644 --- a/mistapi/models/psk_portal_sso.go +++ b/mistapi/models/psk_portal_sso.go @@ -10,7 +10,7 @@ type PskPortalSso struct { // // allowed roles for accessing psk portal, if none, any role is permitted AllowedRoles []string `json:"allowed_roles,omitempty"` IdpCert *string `json:"idp_cert,omitempty"` - // Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` + // Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512`. enum: `sha1`, `sha256`, `sha384`, `sha512` IdpSignAlgo *PskPortalSsoIdpSignAlgoEnum `json:"idp_sign_algo,omitempty"` IdpSsoUrl *string `json:"idp_sso_url,omitempty"` Issuer *string `json:"issuer,omitempty"` diff --git a/mistapi/models/sso.go b/mistapi/models/sso.go index dfd70738..02226048 100644 --- a/mistapi/models/sso.go +++ b/mistapi/models/sso.go @@ -24,7 +24,7 @@ type Sso struct { Id *uuid.UUID `json:"id,omitempty"` // if `idp_type`==`saml`. IDP Cert (used to verify the signed response) IdpCert *string `json:"idp_cert,omitempty"` - // Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` + // Required if `idp_type`==`saml`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` IdpSignAlgo *SsoIdpSignAlgoEnum `json:"idp_sign_algo,omitempty"` // Required if `idp_type`==`saml`, IDP Single-Sign-On URL IdpSsoUrl *string `json:"idp_sso_url,omitempty"` diff --git a/mistapi/models/stats_site.go b/mistapi/models/stats_site.go index 0237b801..1de80be4 100644 --- a/mistapi/models/stats_site.go +++ b/mistapi/models/stats_site.go @@ -10,34 +10,34 @@ import ( // StatsSite represents a StatsSite struct. // Site statistics type StatsSite struct { - Address string `json:"address"` - AlarmtemplateId uuid.UUID `json:"alarmtemplate_id"` - CountryCode string `json:"country_code"` - CreatedTime float64 `json:"created_time"` - Id uuid.UUID `json:"id"` - Lat float64 `json:"lat"` - Latlng LatLng `json:"latlng"` - Lng float64 `json:"lng"` - ModifiedTime float64 `json:"modified_time"` - MspId string `json:"msp_id"` - Name string `json:"name"` - NetworktemplateId uuid.UUID `json:"networktemplate_id"` - NumAp int `json:"num_ap"` - NumApConnected int `json:"num_ap_connected"` - NumClients int `json:"num_clients"` - NumDevices int `json:"num_devices"` - NumDevicesConnected int `json:"num_devices_connected"` - NumGateway int `json:"num_gateway"` - NumGatewayConnected int `json:"num_gateway_connected"` - NumSwitch int `json:"num_switch"` - NumSwitchConnected int `json:"num_switch_connected"` - OrgId uuid.UUID `json:"org_id"` - RftemplateId uuid.UUID `json:"rftemplate_id"` - SecpolicyId *interface{} `json:"secpolicy_id,omitempty"` - SitegroupIds []uuid.UUID `json:"sitegroup_ids"` - Timezone string `json:"timezone"` - Tzoffset int `json:"tzoffset"` - AdditionalProperties map[string]any `json:"_"` + Address string `json:"address"` + AlarmtemplateId *uuid.UUID `json:"alarmtemplate_id"` + CountryCode string `json:"country_code"` + CreatedTime float64 `json:"created_time"` + Id uuid.UUID `json:"id"` + Lat float64 `json:"lat"` + Latlng LatLng `json:"latlng"` + Lng float64 `json:"lng"` + ModifiedTime float64 `json:"modified_time"` + MspId *uuid.UUID `json:"msp_id"` + Name string `json:"name"` + NetworktemplateId *uuid.UUID `json:"networktemplate_id"` + NumAp int `json:"num_ap"` + NumApConnected int `json:"num_ap_connected"` + NumClients int `json:"num_clients"` + NumDevices int `json:"num_devices"` + NumDevicesConnected int `json:"num_devices_connected"` + NumGateway int `json:"num_gateway"` + NumGatewayConnected int `json:"num_gateway_connected"` + NumSwitch int `json:"num_switch"` + NumSwitchConnected int `json:"num_switch_connected"` + OrgId uuid.UUID `json:"org_id"` + RftemplateId *uuid.UUID `json:"rftemplate_id"` + SecpolicyId Optional[uuid.UUID] `json:"secpolicy_id"` + SitegroupIds []uuid.UUID `json:"sitegroup_ids"` + Timezone string `json:"timezone"` + Tzoffset int `json:"tzoffset"` + AdditionalProperties map[string]any `json:"_"` } // MarshalJSON implements the json.Marshaler interface for StatsSite. @@ -53,7 +53,11 @@ func (s StatsSite) toMap() map[string]any { structMap := make(map[string]any) MapAdditionalProperties(structMap, s.AdditionalProperties) structMap["address"] = s.Address - structMap["alarmtemplate_id"] = s.AlarmtemplateId + if s.AlarmtemplateId != nil { + structMap["alarmtemplate_id"] = s.AlarmtemplateId + } else { + structMap["alarmtemplate_id"] = nil + } structMap["country_code"] = s.CountryCode structMap["created_time"] = s.CreatedTime structMap["id"] = s.Id @@ -61,9 +65,17 @@ func (s StatsSite) toMap() map[string]any { structMap["latlng"] = s.Latlng.toMap() structMap["lng"] = s.Lng structMap["modified_time"] = s.ModifiedTime - structMap["msp_id"] = s.MspId + if s.MspId != nil { + structMap["msp_id"] = s.MspId + } else { + structMap["msp_id"] = nil + } structMap["name"] = s.Name - structMap["networktemplate_id"] = s.NetworktemplateId + if s.NetworktemplateId != nil { + structMap["networktemplate_id"] = s.NetworktemplateId + } else { + structMap["networktemplate_id"] = nil + } structMap["num_ap"] = s.NumAp structMap["num_ap_connected"] = s.NumApConnected structMap["num_clients"] = s.NumClients @@ -74,9 +86,17 @@ func (s StatsSite) toMap() map[string]any { structMap["num_switch"] = s.NumSwitch structMap["num_switch_connected"] = s.NumSwitchConnected structMap["org_id"] = s.OrgId - structMap["rftemplate_id"] = s.RftemplateId - if s.SecpolicyId != nil { - structMap["secpolicy_id"] = s.SecpolicyId + if s.RftemplateId != nil { + structMap["rftemplate_id"] = s.RftemplateId + } else { + structMap["rftemplate_id"] = nil + } + if s.SecpolicyId.IsValueSet() { + if s.SecpolicyId.Value() != nil { + structMap["secpolicy_id"] = s.SecpolicyId.Value() + } else { + structMap["secpolicy_id"] = nil + } } structMap["sitegroup_ids"] = s.SitegroupIds structMap["timezone"] = s.Timezone @@ -103,7 +123,7 @@ func (s *StatsSite) UnmarshalJSON(input []byte) error { s.AdditionalProperties = additionalProperties s.Address = *temp.Address - s.AlarmtemplateId = *temp.AlarmtemplateId + s.AlarmtemplateId = temp.AlarmtemplateId s.CountryCode = *temp.CountryCode s.CreatedTime = *temp.CreatedTime s.Id = *temp.Id @@ -111,9 +131,9 @@ func (s *StatsSite) UnmarshalJSON(input []byte) error { s.Latlng = *temp.Latlng s.Lng = *temp.Lng s.ModifiedTime = *temp.ModifiedTime - s.MspId = *temp.MspId + s.MspId = temp.MspId s.Name = *temp.Name - s.NetworktemplateId = *temp.NetworktemplateId + s.NetworktemplateId = temp.NetworktemplateId s.NumAp = *temp.NumAp s.NumApConnected = *temp.NumApConnected s.NumClients = *temp.NumClients @@ -124,7 +144,7 @@ func (s *StatsSite) UnmarshalJSON(input []byte) error { s.NumSwitch = *temp.NumSwitch s.NumSwitchConnected = *temp.NumSwitchConnected s.OrgId = *temp.OrgId - s.RftemplateId = *temp.RftemplateId + s.RftemplateId = temp.RftemplateId s.SecpolicyId = temp.SecpolicyId s.SitegroupIds = *temp.SitegroupIds s.Timezone = *temp.Timezone @@ -134,33 +154,33 @@ func (s *StatsSite) UnmarshalJSON(input []byte) error { // tempStatsSite is a temporary struct used for validating the fields of StatsSite. type tempStatsSite struct { - Address *string `json:"address"` - AlarmtemplateId *uuid.UUID `json:"alarmtemplate_id"` - CountryCode *string `json:"country_code"` - CreatedTime *float64 `json:"created_time"` - Id *uuid.UUID `json:"id"` - Lat *float64 `json:"lat"` - Latlng *LatLng `json:"latlng"` - Lng *float64 `json:"lng"` - ModifiedTime *float64 `json:"modified_time"` - MspId *string `json:"msp_id"` - Name *string `json:"name"` - NetworktemplateId *uuid.UUID `json:"networktemplate_id"` - NumAp *int `json:"num_ap"` - NumApConnected *int `json:"num_ap_connected"` - NumClients *int `json:"num_clients"` - NumDevices *int `json:"num_devices"` - NumDevicesConnected *int `json:"num_devices_connected"` - NumGateway *int `json:"num_gateway"` - NumGatewayConnected *int `json:"num_gateway_connected"` - NumSwitch *int `json:"num_switch"` - NumSwitchConnected *int `json:"num_switch_connected"` - OrgId *uuid.UUID `json:"org_id"` - RftemplateId *uuid.UUID `json:"rftemplate_id"` - SecpolicyId *interface{} `json:"secpolicy_id,omitempty"` - SitegroupIds *[]uuid.UUID `json:"sitegroup_ids"` - Timezone *string `json:"timezone"` - Tzoffset *int `json:"tzoffset"` + Address *string `json:"address"` + AlarmtemplateId *uuid.UUID `json:"alarmtemplate_id"` + CountryCode *string `json:"country_code"` + CreatedTime *float64 `json:"created_time"` + Id *uuid.UUID `json:"id"` + Lat *float64 `json:"lat"` + Latlng *LatLng `json:"latlng"` + Lng *float64 `json:"lng"` + ModifiedTime *float64 `json:"modified_time"` + MspId *uuid.UUID `json:"msp_id"` + Name *string `json:"name"` + NetworktemplateId *uuid.UUID `json:"networktemplate_id"` + NumAp *int `json:"num_ap"` + NumApConnected *int `json:"num_ap_connected"` + NumClients *int `json:"num_clients"` + NumDevices *int `json:"num_devices"` + NumDevicesConnected *int `json:"num_devices_connected"` + NumGateway *int `json:"num_gateway"` + NumGatewayConnected *int `json:"num_gateway_connected"` + NumSwitch *int `json:"num_switch"` + NumSwitchConnected *int `json:"num_switch_connected"` + OrgId *uuid.UUID `json:"org_id"` + RftemplateId *uuid.UUID `json:"rftemplate_id"` + SecpolicyId Optional[uuid.UUID] `json:"secpolicy_id"` + SitegroupIds *[]uuid.UUID `json:"sitegroup_ids"` + Timezone *string `json:"timezone"` + Tzoffset *int `json:"tzoffset"` } func (s *tempStatsSite) validate() error { @@ -168,9 +188,6 @@ func (s *tempStatsSite) validate() error { if s.Address == nil { errs = append(errs, "required field `address` is missing for type `stats_site`") } - if s.AlarmtemplateId == nil { - errs = append(errs, "required field `alarmtemplate_id` is missing for type `stats_site`") - } if s.CountryCode == nil { errs = append(errs, "required field `country_code` is missing for type `stats_site`") } @@ -192,15 +209,9 @@ func (s *tempStatsSite) validate() error { if s.ModifiedTime == nil { errs = append(errs, "required field `modified_time` is missing for type `stats_site`") } - if s.MspId == nil { - errs = append(errs, "required field `msp_id` is missing for type `stats_site`") - } if s.Name == nil { errs = append(errs, "required field `name` is missing for type `stats_site`") } - if s.NetworktemplateId == nil { - errs = append(errs, "required field `networktemplate_id` is missing for type `stats_site`") - } if s.NumAp == nil { errs = append(errs, "required field `num_ap` is missing for type `stats_site`") } @@ -231,9 +242,6 @@ func (s *tempStatsSite) validate() error { if s.OrgId == nil { errs = append(errs, "required field `org_id` is missing for type `stats_site`") } - if s.RftemplateId == nil { - errs = append(errs, "required field `rftemplate_id` is missing for type `stats_site`") - } if s.SitegroupIds == nil { errs = append(errs, "required field `sitegroup_ids` is missing for type `stats_site`") } diff --git a/mistapi/models/stats_wrule.go b/mistapi/models/stats_wxrule.go similarity index 51% rename from mistapi/models/stats_wrule.go rename to mistapi/models/stats_wxrule.go index b74d9020..829b040b 100644 --- a/mistapi/models/stats_wrule.go +++ b/mistapi/models/stats_wxrule.go @@ -7,32 +7,32 @@ import ( "strings" ) -// StatsWrule represents a StatsWrule struct. +// StatsWxrule represents a StatsWxrule struct. // Wxrule statistics -type StatsWrule struct { +type StatsWxrule struct { // enum: `allow`, `block` - Action StatsWruleActionEnum `json:"action"` - ClientMac []string `json:"client_mac"` - DstAllowWxtags []uuid.UUID `json:"dst_allow_wxtags"` - DstDenyWxtags []uuid.UUID `json:"dst_deny_wxtags"` - DstWxtags []uuid.UUID `json:"dst_wxtags"` - Name string `json:"name"` - Order int `json:"order"` - SrcWxtags []uuid.UUID `json:"src_wxtags"` - Usage map[string]StatsWruleUsageProperties `json:"usage"` - AdditionalProperties map[string]any `json:"_"` + Action StatsWxruleActionEnum `json:"action"` + ClientMac []string `json:"client_mac"` + DstAllowWxtags []uuid.UUID `json:"dst_allow_wxtags"` + DstDenyWxtags []uuid.UUID `json:"dst_deny_wxtags"` + DstWxtags []uuid.UUID `json:"dst_wxtags"` + Name string `json:"name"` + Order int `json:"order"` + SrcWxtags []uuid.UUID `json:"src_wxtags"` + Usage map[string]StatsWxruleUsageProperties `json:"usage"` + AdditionalProperties map[string]any `json:"_"` } -// MarshalJSON implements the json.Marshaler interface for StatsWrule. -// It customizes the JSON marshaling process for StatsWrule objects. -func (s StatsWrule) MarshalJSON() ( +// MarshalJSON implements the json.Marshaler interface for StatsWxrule. +// It customizes the JSON marshaling process for StatsWxrule objects. +func (s StatsWxrule) MarshalJSON() ( []byte, error) { return json.Marshal(s.toMap()) } -// toMap converts the StatsWrule object to a map representation for JSON marshaling. -func (s StatsWrule) toMap() map[string]any { +// toMap converts the StatsWxrule object to a map representation for JSON marshaling. +func (s StatsWxrule) toMap() map[string]any { structMap := make(map[string]any) MapAdditionalProperties(structMap, s.AdditionalProperties) structMap["action"] = s.Action @@ -47,10 +47,10 @@ func (s StatsWrule) toMap() map[string]any { return structMap } -// UnmarshalJSON implements the json.Unmarshaler interface for StatsWrule. -// It customizes the JSON unmarshaling process for StatsWrule objects. -func (s *StatsWrule) UnmarshalJSON(input []byte) error { - var temp tempStatsWrule +// UnmarshalJSON implements the json.Unmarshaler interface for StatsWxrule. +// It customizes the JSON unmarshaling process for StatsWxrule objects. +func (s *StatsWxrule) UnmarshalJSON(input []byte) error { + var temp tempStatsWxrule err := json.Unmarshal(input, &temp) if err != nil { return err @@ -77,47 +77,47 @@ func (s *StatsWrule) UnmarshalJSON(input []byte) error { return nil } -// tempStatsWrule is a temporary struct used for validating the fields of StatsWrule. -type tempStatsWrule struct { - Action *StatsWruleActionEnum `json:"action"` - ClientMac *[]string `json:"client_mac"` - DstAllowWxtags *[]uuid.UUID `json:"dst_allow_wxtags"` - DstDenyWxtags *[]uuid.UUID `json:"dst_deny_wxtags"` - DstWxtags *[]uuid.UUID `json:"dst_wxtags"` - Name *string `json:"name"` - Order *int `json:"order"` - SrcWxtags *[]uuid.UUID `json:"src_wxtags"` - Usage *map[string]StatsWruleUsageProperties `json:"usage"` +// tempStatsWxrule is a temporary struct used for validating the fields of StatsWxrule. +type tempStatsWxrule struct { + Action *StatsWxruleActionEnum `json:"action"` + ClientMac *[]string `json:"client_mac"` + DstAllowWxtags *[]uuid.UUID `json:"dst_allow_wxtags"` + DstDenyWxtags *[]uuid.UUID `json:"dst_deny_wxtags"` + DstWxtags *[]uuid.UUID `json:"dst_wxtags"` + Name *string `json:"name"` + Order *int `json:"order"` + SrcWxtags *[]uuid.UUID `json:"src_wxtags"` + Usage *map[string]StatsWxruleUsageProperties `json:"usage"` } -func (s *tempStatsWrule) validate() error { +func (s *tempStatsWxrule) validate() error { var errs []string if s.Action == nil { - errs = append(errs, "required field `action` is missing for type `stats_wrule`") + errs = append(errs, "required field `action` is missing for type `stats_wxrule`") } if s.ClientMac == nil { - errs = append(errs, "required field `client_mac` is missing for type `stats_wrule`") + errs = append(errs, "required field `client_mac` is missing for type `stats_wxrule`") } if s.DstAllowWxtags == nil { - errs = append(errs, "required field `dst_allow_wxtags` is missing for type `stats_wrule`") + errs = append(errs, "required field `dst_allow_wxtags` is missing for type `stats_wxrule`") } if s.DstDenyWxtags == nil { - errs = append(errs, "required field `dst_deny_wxtags` is missing for type `stats_wrule`") + errs = append(errs, "required field `dst_deny_wxtags` is missing for type `stats_wxrule`") } if s.DstWxtags == nil { - errs = append(errs, "required field `dst_wxtags` is missing for type `stats_wrule`") + errs = append(errs, "required field `dst_wxtags` is missing for type `stats_wxrule`") } if s.Name == nil { - errs = append(errs, "required field `name` is missing for type `stats_wrule`") + errs = append(errs, "required field `name` is missing for type `stats_wxrule`") } if s.Order == nil { - errs = append(errs, "required field `order` is missing for type `stats_wrule`") + errs = append(errs, "required field `order` is missing for type `stats_wxrule`") } if s.SrcWxtags == nil { - errs = append(errs, "required field `src_wxtags` is missing for type `stats_wrule`") + errs = append(errs, "required field `src_wxtags` is missing for type `stats_wxrule`") } if s.Usage == nil { - errs = append(errs, "required field `usage` is missing for type `stats_wrule`") + errs = append(errs, "required field `usage` is missing for type `stats_wxrule`") } if len(errs) == 0 { return nil diff --git a/mistapi/models/stats_wrule_usage_properties.go b/mistapi/models/stats_wxrule_usage_properties.go similarity index 52% rename from mistapi/models/stats_wrule_usage_properties.go rename to mistapi/models/stats_wxrule_usage_properties.go index 812038a6..5a775dd9 100644 --- a/mistapi/models/stats_wrule_usage_properties.go +++ b/mistapi/models/stats_wxrule_usage_properties.go @@ -4,22 +4,22 @@ import ( "encoding/json" ) -// StatsWruleUsageProperties represents a StatsWruleUsageProperties struct. -type StatsWruleUsageProperties struct { +// StatsWxruleUsageProperties represents a StatsWxruleUsageProperties struct. +type StatsWxruleUsageProperties struct { NumFlows *int `json:"num_flows,omitempty"` AdditionalProperties map[string]any `json:"_"` } -// MarshalJSON implements the json.Marshaler interface for StatsWruleUsageProperties. -// It customizes the JSON marshaling process for StatsWruleUsageProperties objects. -func (s StatsWruleUsageProperties) MarshalJSON() ( +// MarshalJSON implements the json.Marshaler interface for StatsWxruleUsageProperties. +// It customizes the JSON marshaling process for StatsWxruleUsageProperties objects. +func (s StatsWxruleUsageProperties) MarshalJSON() ( []byte, error) { return json.Marshal(s.toMap()) } -// toMap converts the StatsWruleUsageProperties object to a map representation for JSON marshaling. -func (s StatsWruleUsageProperties) toMap() map[string]any { +// toMap converts the StatsWxruleUsageProperties object to a map representation for JSON marshaling. +func (s StatsWxruleUsageProperties) toMap() map[string]any { structMap := make(map[string]any) MapAdditionalProperties(structMap, s.AdditionalProperties) if s.NumFlows != nil { @@ -28,10 +28,10 @@ func (s StatsWruleUsageProperties) toMap() map[string]any { return structMap } -// UnmarshalJSON implements the json.Unmarshaler interface for StatsWruleUsageProperties. -// It customizes the JSON unmarshaling process for StatsWruleUsageProperties objects. -func (s *StatsWruleUsageProperties) UnmarshalJSON(input []byte) error { - var temp tempStatsWruleUsageProperties +// UnmarshalJSON implements the json.Unmarshaler interface for StatsWxruleUsageProperties. +// It customizes the JSON unmarshaling process for StatsWxruleUsageProperties objects. +func (s *StatsWxruleUsageProperties) UnmarshalJSON(input []byte) error { + var temp tempStatsWxruleUsageProperties err := json.Unmarshal(input, &temp) if err != nil { return err @@ -46,7 +46,7 @@ func (s *StatsWruleUsageProperties) UnmarshalJSON(input []byte) error { return nil } -// tempStatsWruleUsageProperties is a temporary struct used for validating the fields of StatsWruleUsageProperties. -type tempStatsWruleUsageProperties struct { +// tempStatsWxruleUsageProperties is a temporary struct used for validating the fields of StatsWxruleUsageProperties. +type tempStatsWxruleUsageProperties struct { NumFlows *int `json:"num_flows,omitempty"` } diff --git a/mistapi/models/utils_show_dhcp_leases.go b/mistapi/models/utils_show_dhcp_leases.go index 33de4d68..bfd7a9a5 100644 --- a/mistapi/models/utils_show_dhcp_leases.go +++ b/mistapi/models/utils_show_dhcp_leases.go @@ -2,12 +2,14 @@ package models import ( "encoding/json" + "errors" + "strings" ) // UtilsShowDhcpLeases represents a UtilsShowDhcpLeases struct. type UtilsShowDhcpLeases struct { // DHCP network for the leases, returns full table if not specified - Network *string `json:"network,omitempty"` + Network string `json:"network"` // only for HA. enum: `node0`, `node1` Node *HaClusterNodeEnum `json:"node,omitempty"` AdditionalProperties map[string]any `json:"_"` @@ -25,9 +27,7 @@ func (u UtilsShowDhcpLeases) MarshalJSON() ( func (u UtilsShowDhcpLeases) toMap() map[string]any { structMap := make(map[string]any) MapAdditionalProperties(structMap, u.AdditionalProperties) - if u.Network != nil { - structMap["network"] = u.Network - } + structMap["network"] = u.Network if u.Node != nil { structMap["node"] = u.Node } @@ -42,19 +42,34 @@ func (u *UtilsShowDhcpLeases) UnmarshalJSON(input []byte) error { if err != nil { return err } + err = temp.validate() + if err != nil { + return err + } additionalProperties, err := UnmarshalAdditionalProperties(input, "network", "node") if err != nil { return err } u.AdditionalProperties = additionalProperties - u.Network = temp.Network + u.Network = *temp.Network u.Node = temp.Node return nil } // tempUtilsShowDhcpLeases is a temporary struct used for validating the fields of UtilsShowDhcpLeases. type tempUtilsShowDhcpLeases struct { - Network *string `json:"network,omitempty"` + Network *string `json:"network"` Node *HaClusterNodeEnum `json:"node,omitempty"` } + +func (u *tempUtilsShowDhcpLeases) validate() error { + var errs []string + if u.Network == nil { + errs = append(errs, "required field `network` is missing for type `utils_show_dhcp_leases`") + } + if len(errs) == 0 { + return nil + } + return errors.New(strings.Join (errs, "\n")) +} diff --git a/mistapi/models/wlan_portal.go b/mistapi/models/wlan_portal.go index 33afdfd9..3192338a 100644 --- a/mistapi/models/wlan_portal.go +++ b/mistapi/models/wlan_portal.go @@ -7,6 +7,8 @@ import ( // WlanPortal represents a WlanPortal struct. // portal wlan settings type WlanPortal struct { + // whether to allow guest to connect to other Guest WLANs (with different `WLAN.ssid`) of same org without reauthentication (disable random_mac for seamless roaming) + AllowWlanIdRoam *bool `json:"allow_wlan_id_roam,omitempty"` // amazon OAuth2 client id. This is optional. If not provided, it will use a default one. AmazonClientId Optional[string] `json:"amazon_client_id"` // amazon OAuth2 client secret. If amazon_client_id was provided, provide a correspoinding value. Else leave blank. @@ -140,7 +142,7 @@ type WlanPortal struct { SsoForcedRole *string `json:"sso_forced_role,omitempty"` // if `wlan_portal_auth`==`sso`, IDP Cert (used to verify the signed response) SsoIdpCert *string `json:"sso_idp_cert,omitempty"` - // if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum `sha1`, `sha256`, `sha384`, `sha512` + // if `wlan_portal_auth`==`sso`, Signing algorithm for SAML Assertion. enum: `sha1`, `sha256`, `sha384`, `sha512` SsoIdpSignAlgo *WlanPortalIdpSignAlgoEnum `json:"sso_idp_sign_algo,omitempty"` // if `wlan_portal_auth`==`sso`, IDP Single-Sign-On URL SsoIdpSsoUrl *string `json:"sso_idp_sso_url,omitempty"` @@ -173,6 +175,9 @@ func (w WlanPortal) MarshalJSON() ( func (w WlanPortal) toMap() map[string]any { structMap := make(map[string]any) MapAdditionalProperties(structMap, w.AdditionalProperties) + if w.AllowWlanIdRoam != nil { + structMap["allow_wlan_id_roam"] = w.AllowWlanIdRoam + } if w.AmazonClientId.IsValueSet() { if w.AmazonClientId.Value() != nil { structMap["amazon_client_id"] = w.AmazonClientId.Value() @@ -499,12 +504,13 @@ func (w *WlanPortal) UnmarshalJSON(input []byte) error { if err != nil { return err } - additionalProperties, err := UnmarshalAdditionalProperties(input, "amazon_client_id", "amazon_client_secret", "amazon_email_domains", "amazon_enabled", "amazon_expire", "auth", "azure_client_id", "azure_client_secret", "azure_enabled", "azure_expire", "azure_tenant_id", "broadnet_password", "broadnet_sid", "broadnet_user_id", "bypass_when_cloud_down", "clickatell_api_key", "cross_site", "email_enabled", "enabled", "expire", "external_portal_url", "facebook_client_id", "facebook_client_secret", "facebook_email_domains", "facebook_enabled", "facebook_expire", "forward", "forward_url", "google_client_id", "google_client_secret", "google_email_domains", "google_enabled", "google_expire", "gupshup_password", "gupshup_userid", "microsoft_client_id", "microsoft_client_secret", "microsoft_email_domains", "microsoft_enabled", "microsoft_expire", "passphrase_enabled", "passphrase_expire", "password", "predefined_sponsors_enabled", "predefined_sponsors_hide_email", "privacy", "puzzel_password", "puzzel_service_id", "puzzel_username", "smsMessageFormat", "sms_enabled", "sms_expire", "sms_provider", "sponsor_auto_approve", "sponsor_email_domains", "sponsor_enabled", "sponsor_expire", "sponsor_link_validity_duration", "sponsor_notify_all", "sponsor_status_notify", "sponsors", "sso_default_role", "sso_forced_role", "sso_idp_cert", "sso_idp_sign_algo", "sso_idp_sso_url", "sso_issuer", "sso_nameid_format", "telstra_client_id", "telstra_client_secret", "twilio_auth_token", "twilio_phone_number", "twilio_sid") + additionalProperties, err := UnmarshalAdditionalProperties(input, "allow_wlan_id_roam", "amazon_client_id", "amazon_client_secret", "amazon_email_domains", "amazon_enabled", "amazon_expire", "auth", "azure_client_id", "azure_client_secret", "azure_enabled", "azure_expire", "azure_tenant_id", "broadnet_password", "broadnet_sid", "broadnet_user_id", "bypass_when_cloud_down", "clickatell_api_key", "cross_site", "email_enabled", "enabled", "expire", "external_portal_url", "facebook_client_id", "facebook_client_secret", "facebook_email_domains", "facebook_enabled", "facebook_expire", "forward", "forward_url", "google_client_id", "google_client_secret", "google_email_domains", "google_enabled", "google_expire", "gupshup_password", "gupshup_userid", "microsoft_client_id", "microsoft_client_secret", "microsoft_email_domains", "microsoft_enabled", "microsoft_expire", "passphrase_enabled", "passphrase_expire", "password", "predefined_sponsors_enabled", "predefined_sponsors_hide_email", "privacy", "puzzel_password", "puzzel_service_id", "puzzel_username", "smsMessageFormat", "sms_enabled", "sms_expire", "sms_provider", "sponsor_auto_approve", "sponsor_email_domains", "sponsor_enabled", "sponsor_expire", "sponsor_link_validity_duration", "sponsor_notify_all", "sponsor_status_notify", "sponsors", "sso_default_role", "sso_forced_role", "sso_idp_cert", "sso_idp_sign_algo", "sso_idp_sso_url", "sso_issuer", "sso_nameid_format", "telstra_client_id", "telstra_client_secret", "twilio_auth_token", "twilio_phone_number", "twilio_sid") if err != nil { return err } w.AdditionalProperties = additionalProperties + w.AllowWlanIdRoam = temp.AllowWlanIdRoam w.AmazonClientId = temp.AmazonClientId w.AmazonClientSecret = temp.AmazonClientSecret w.AmazonEmailDomains = temp.AmazonEmailDomains @@ -583,6 +589,7 @@ func (w *WlanPortal) UnmarshalJSON(input []byte) error { // tempWlanPortal is a temporary struct used for validating the fields of WlanPortal. type tempWlanPortal struct { + AllowWlanIdRoam *bool `json:"allow_wlan_id_roam,omitempty"` AmazonClientId Optional[string] `json:"amazon_client_id"` AmazonClientSecret Optional[string] `json:"amazon_client_secret"` AmazonEmailDomains []string `json:"amazon_email_domains,omitempty"` diff --git a/mistapi/orgs_clients_wired.go b/mistapi/orgs_clients_wired.go index ee2f3b2c..b5358130 100644 --- a/mistapi/orgs_clients_wired.go +++ b/mistapi/orgs_clients_wired.go @@ -90,7 +90,7 @@ func (o *OrgsClientsWired) CountOrgWiredClients( return models.NewApiResponse(result, resp), err } -// SearchOrgWiredClients takes context, orgId, siteId, deviceMac, mac, portId, vlan, ip, manufacture, text, nacruleId, dhcpHostname, dhcpFqdn, dhcpClientIdentifier, dhcpVendorClassIdentifier, dhcpRequestParams, limit, start, end, duration as parameters and +// SearchOrgWiredClients takes context, orgId, siteId, deviceMac, mac, portId, vlan, ipAddress, manufacture, text, nacruleId, dhcpHostname, dhcpFqdn, dhcpClientIdentifier, dhcpVendorClassIdentifier, dhcpRequestParams, limit, start, end, duration as parameters and // returns an models.ApiResponse with models.SearchWiredClient data and // an error if there was an issue with the request or response. // Search for Wired Clients in org @@ -103,7 +103,7 @@ func (o *OrgsClientsWired) SearchOrgWiredClients( mac *string, portId *string, vlan *int, - ip *string, + ipAddress *string, manufacture *string, text *string, nacruleId *string, @@ -156,8 +156,8 @@ func (o *OrgsClientsWired) SearchOrgWiredClients( if vlan != nil { req.QueryParam("vlan", *vlan) } - if ip != nil { - req.QueryParam("ip", *ip) + if ipAddress != nil { + req.QueryParam("ip_address", *ipAddress) } if manufacture != nil { req.QueryParam("manufacture", *manufacture) diff --git a/mistapi/orgs_clients_wired_test.go b/mistapi/orgs_clients_wired_test.go index d8e1c988..3a39dde0 100644 --- a/mistapi/orgs_clients_wired_test.go +++ b/mistapi/orgs_clients_wired_test.go @@ -46,7 +46,7 @@ func TestOrgsClientsWiredTestSearchOrgWiredClients(t *testing.T) { - + ipAddress := "192.168.1.1" @@ -59,7 +59,7 @@ func TestOrgsClientsWiredTestSearchOrgWiredClients(t *testing.T) { duration := "1d" - apiResponse, err := orgsClientsWired.SearchOrgWiredClients(ctx, orgId, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, &limit, nil, nil, &duration) + apiResponse, err := orgsClientsWired.SearchOrgWiredClients(ctx, orgId, nil, nil, nil, nil, nil, &ipAddress, nil, nil, nil, nil, nil, nil, nil, nil, &limit, nil, nil, &duration) if err != nil { t.Errorf("Endpoint call failed: %v", err) } diff --git a/mistapi/orgs_clients_wireless.go b/mistapi/orgs_clients_wireless.go index 226949ba..f5d422d6 100644 --- a/mistapi/orgs_clients_wireless.go +++ b/mistapi/orgs_clients_wireless.go @@ -216,7 +216,7 @@ func (o *OrgsClientsWireless) SearchOrgWirelessClientEvents( return models.NewApiResponse(result, resp), err } -// SearchOrgWirelessClients takes context, orgId, siteId, mac, ipAddress, hostname, device, os, model, ap, pskId, pskName, vlan, ssid, text, limit, start, end, duration as parameters and +// SearchOrgWirelessClients takes context, orgId, siteId, mac, ipAddress, hostname, band, device, os, model, ap, pskId, pskName, username, vlan, ssid, text, limit, start, end, duration as parameters and // returns an models.ApiResponse with models.ResponseClientSearch data and // an error if there was an issue with the request or response. // Search Org Wireless Clients @@ -227,12 +227,14 @@ func (o *OrgsClientsWireless) SearchOrgWirelessClients( mac *string, ipAddress *string, hostname *string, + band *string, device *string, os *string, model *string, ap *string, pskId *string, pskName *string, + username *string, vlan *string, ssid *string, text *string, @@ -277,6 +279,9 @@ func (o *OrgsClientsWireless) SearchOrgWirelessClients( if hostname != nil { req.QueryParam("hostname", *hostname) } + if band != nil { + req.QueryParam("band", *band) + } if device != nil { req.QueryParam("device", *device) } @@ -295,6 +300,9 @@ func (o *OrgsClientsWireless) SearchOrgWirelessClients( if pskName != nil { req.QueryParam("psk_name", *pskName) } + if username != nil { + req.QueryParam("username", *username) + } if vlan != nil { req.QueryParam("vlan", *vlan) } diff --git a/mistapi/orgs_clients_wireless_test.go b/mistapi/orgs_clients_wireless_test.go index ed5c540b..abaa6fe9 100644 --- a/mistapi/orgs_clients_wireless_test.go +++ b/mistapi/orgs_clients_wireless_test.go @@ -90,16 +90,18 @@ func TestOrgsClientsWirelessTestSearchOrgWirelessClients(t *testing.T) { + pskId := "000000ab-00ab-00ab-00ab-0000000000ab" + limit := int(100) duration := "1d" - apiResponse, err := orgsClientsWireless.SearchOrgWirelessClients(ctx, orgId, nil, nil, &ipAddress, nil, nil, nil, nil, nil, &pskId, nil, nil, nil, nil, &limit, nil, nil, &duration) + apiResponse, err := orgsClientsWireless.SearchOrgWirelessClients(ctx, orgId, nil, nil, &ipAddress, nil, nil, nil, nil, nil, nil, &pskId, nil, nil, nil, nil, nil, &limit, nil, nil, &duration) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -108,7 +110,7 @@ func TestOrgsClientsWirelessTestSearchOrgWirelessClients(t *testing.T) { testHelper.NewTestHeader(true,"Content-Type","application/json"), } testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) - expected := `{"end":17141231418.812,"limit":118,"next":"next8","results":[{"ap":["a83a79a947ee","003e73170b4c"],"app_version":["0.100.3"],"band":"5","device":["Mac"],"ftc":false,"hardware":"Apple Wi-Fi adapter","hostname":["hostname-a","hostname-b"],"ip":["10.5.23.43","192.168.0.2"],"last_ap":"a83a79a947ee","last_devuce":"Mac","last_firmware":"wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675","last_hostname":"hostname-a","last_ip":"10.5.23.43","last_model":"MBP 16\\\" M1 2021","last_os":"Sonoma","last_os_version":"14.4.1 (Build 23E224)","last_psk_id":"abf7dc5c-bb51-4bb7-93b6-5547400ffe11","last_psk_name":"iot","last_ssid":"IoT SSID","last_username":"user@corp.com","last_vlan":10,"last_wlan_id":"e5d67b07-aae8-494b-8584-cbc20c8110aa","mac":"bcd074000000","mfg":"Apple","model":"MBP 16\\\" M1 2021","org_id":"1abff1aa-4571-4c1f-a409-153a1e7a7a24","os":["Sonoma"],"os_version":["14.4.1 (Build 23E224)"],"protocol":"ax","psk_id":["abf7dc5c-bb51-4bb7-93b6-5547400ffe11"],"psk_name":["iot"],"sdk_version":["0.100.3"],"site_id":"25ff5219-9be7-4db9-907d-0c9b60445147","site_ids":["25ff5219-9be7-4db9-907d-0c9b60445147"],"ssid":["IoT SSID"],"timestamp":1714124722.113,"username":["user@corp.com"],"vlan":[10]}],"start":10,"total":44}` + expected := `{"end":17141231418.812,"limit":118,"next":"next8","results":[{"ap":["a83a79a947ee","003e73170b4c"],"app_version":["0.100.3"],"band":"5","device":["Mac"],"ftc":false,"hardware":"Apple Wi-Fi adapter","hostname":["hostname-a","hostname-b"],"ip":["10.5.23.43","192.168.0.2"],"last_ap":"a83a79a947ee","last_device":"Mac","last_firmware":"wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675","last_hostname":"hostname-a","last_ip":"10.5.23.43","last_model":"MBP 16\\\" M1 2021","last_os":"Sonoma","last_os_version":"14.4.1 (Build 23E224)","last_psk_id":"abf7dc5c-bb51-4bb7-93b6-5547400ffe11","last_psk_name":"iot","last_ssid":"IoT SSID","last_username":"user@corp.com","last_vlan":10,"last_wlan_id":"e5d67b07-aae8-494b-8584-cbc20c8110aa","mac":"bcd074000000","mfg":"Apple","model":"MBP 16\\\" M1 2021","org_id":"1abff1aa-4571-4c1f-a409-153a1e7a7a24","os":["Sonoma"],"os_version":["14.4.1 (Build 23E224)"],"protocol":"ax","psk_id":["abf7dc5c-bb51-4bb7-93b6-5547400ffe11"],"psk_name":["iot"],"sdk_version":["0.100.3"],"site_id":"25ff5219-9be7-4db9-907d-0c9b60445147","site_ids":["25ff5219-9be7-4db9-907d-0c9b60445147"],"ssid":["IoT SSID"],"timestamp":1714124722.113,"username":["user@corp.com"],"vlan":[10]}],"start":10,"total":44}` testHelper.KeysBodyMatcher(t, expected, apiResponse.Response.Body, false, false) } diff --git a/mistapi/orgs_guests.go b/mistapi/orgs_guests.go index 5e8a2a0e..30cd6ccb 100644 --- a/mistapi/orgs_guests.go +++ b/mistapi/orgs_guests.go @@ -293,7 +293,7 @@ func (o *OrgsGuests) UpdateOrgGuestAuthorization( ctx context.Context, orgId uuid.UUID, guestMac string, - body *models.Guest) ( + body *models.GuestOrg) ( models.ApiResponse[models.Guest], error) { req := o.prepareRequest( diff --git a/mistapi/orgs_guests_test.go b/mistapi/orgs_guests_test.go index 57966c11..983dcecc 100644 --- a/mistapi/orgs_guests_test.go +++ b/mistapi/orgs_guests_test.go @@ -2,7 +2,6 @@ package mistapi import ( "context" - "encoding/json" "github.com/apimatic/go-core-runtime/testHelper" "github.com/google/uuid" "github.com/tmunzer/mistapi-go/mistapi/models" @@ -126,12 +125,8 @@ func TestOrgsGuestsTestUpdateOrgGuestAuthorization(t *testing.T) { t.Error(errUUID) } guestMac := "0000000000ab" - var body models.Guest - errBody := json.Unmarshal([]byte(`{"authorized":true,"company":"string","email":"user@example.com","field1":"string","field2":"string","field3":"string","field4":"string","mac":"string","minutes":0,"name":"string"}`), &body) - if errBody != nil { - t.Errorf("Cannot parse the model object.") - } - apiResponse, err := orgsGuests.UpdateOrgGuestAuthorization(ctx, orgId, guestMac, &body) + + apiResponse, err := orgsGuests.UpdateOrgGuestAuthorization(ctx, orgId, guestMac, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } diff --git a/mistapi/orgs_stats_sites.go b/mistapi/orgs_stats_sites.go new file mode 100644 index 00000000..e1d18699 --- /dev/null +++ b/mistapi/orgs_stats_sites.go @@ -0,0 +1,86 @@ +package mistapi + +import ( + "context" + "fmt" + "github.com/apimatic/go-core-runtime/https" + "github.com/apimatic/go-core-runtime/utilities" + "github.com/google/uuid" + "github.com/tmunzer/mistapi-go/mistapi/errors" + "github.com/tmunzer/mistapi-go/mistapi/models" +) + +// OrgsStatsSites represents a controller struct. +type OrgsStatsSites struct { + baseController +} + +// NewOrgsStatsSites creates a new instance of OrgsStatsSites. +// It takes a baseController as a parameter and returns a pointer to the OrgsStatsSites. +func NewOrgsStatsSites(baseController baseController) *OrgsStatsSites { + orgsStatsSites := OrgsStatsSites{baseController: baseController} + return &orgsStatsSites +} + +// ListOrgSiteStats takes context, orgId, start, end, duration, limit, page as parameters and +// returns an models.ApiResponse with []models.StatsSite data and +// an error if there was an issue with the request or response. +// Get List of Org Site Stats +func (o *OrgsStatsSites) ListOrgSiteStats( + ctx context.Context, + orgId uuid.UUID, + start *int, + end *int, + duration *string, + limit *int, + page *int) ( + models.ApiResponse[[]models.StatsSite], + error) { + req := o.prepareRequest( + ctx, + "GET", + fmt.Sprintf("/api/v1/orgs/%v/stats/sites", orgId), + ) + req.Authenticate( + NewOrAuth( + NewAuth("apiToken"), + NewAuth("basicAuth"), + NewAndAuth( + NewAuth("basicAuth"), + NewAuth("csrfToken"), + ), + + ), + ) + req.AppendErrors(map[string]https.ErrorBuilder[error]{ + "400": {Message: "Bad Syntax", Unmarshaller: errors.NewResponseHttp400}, + "401": {Message: "Unauthorized", Unmarshaller: errors.NewResponseHttp401Error}, + "403": {Message: "Permission Denied", Unmarshaller: errors.NewResponseHttp403Error}, + "404": {Message: "Not found. The API endpoint doesn’t exist or resource doesn’ t exist", Unmarshaller: errors.NewResponseHttp404}, + "429": {Message: "Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold", Unmarshaller: errors.NewResponseHttp429Error}, + }) + if start != nil { + req.QueryParam("start", *start) + } + if end != nil { + req.QueryParam("end", *end) + } + if duration != nil { + req.QueryParam("duration", *duration) + } + if limit != nil { + req.QueryParam("limit", *limit) + } + if page != nil { + req.QueryParam("page", *page) + } + + var result []models.StatsSite + decoder, resp, err := req.CallAsJson() + if err != nil { + return models.NewApiResponse(result, resp), err + } + + result, err = utilities.DecodeResults[[]models.StatsSite](decoder) + return models.NewApiResponse(result, resp), err +} diff --git a/mistapi/orgs_stats_sites_test.go b/mistapi/orgs_stats_sites_test.go new file mode 100644 index 00000000..747f066a --- /dev/null +++ b/mistapi/orgs_stats_sites_test.go @@ -0,0 +1,33 @@ +package mistapi + +import ( + "context" + "github.com/apimatic/go-core-runtime/testHelper" + "github.com/google/uuid" + "testing" +) + +// TestOrgsStatsSitesTestListOrgSiteStats tests the behavior of the OrgsStatsSites +func TestOrgsStatsSitesTestListOrgSiteStats(t *testing.T) { + ctx := context.Background() + orgId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") + if errUUID != nil { + t.Error(errUUID) + } + + + duration := "1d" + limit := int(100) + page := int(1) + apiResponse, err := orgsStatsSites.ListOrgSiteStats(ctx, orgId, nil, nil, &duration, &limit, &page) + if err != nil { + t.Errorf("Endpoint call failed: %v", err) + } + testHelper.CheckResponseStatusCode(t, apiResponse.Response.StatusCode, 200) + expectedHeaders:= []testHelper.TestHeader{ + testHelper.NewTestHeader(true,"Content-Type","application/json"), + } + testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) + expected := `[{"address":"1601 S De Anza Blvd, Cupertino, CA 95014, USA","alarmtemplate_id":null,"analyticEnabled":true,"aptemplate_id":null,"country_code":"US","created_time":1472591606,"engagementEnabled":true,"gatewaytemplate_id":"e571f2a2-d748-4ad4-bd6c-895467957c21","id":"83bc290a-b76d-47fa-a294-d34e47f30f7f","lat":37.295553,"latlng":{"lat":37.295553,"lng":-122.033007},"lng":-122.033007,"modified_time":1728057857,"msp_id":"a9af4951-a1de-4520-b398-c95a58947349","name":"Live-Demo","networktemplate_id":"964cb213-deb2-469d-8c1e-a5f8661c6886","notes":"This site is used for demonstration purposes.","num_ap":17,"num_ap_connected":14,"num_clients":14,"num_devices":26,"num_devices_connected":22,"num_gateway":1,"num_gateway_connected":1,"num_switch":8,"num_switch_connected":7,"org_id":"b9814b40-ac4b-4424-86a8-b787eb68b86a","rftemplate_id":"2c134c07-3c57-46b3-a53b-8aea92ed7234","secpolicy_id":null,"sitegroup_ids":["5644a432-eea9-4a2f-a30a-ddaf4dbc79cf","5fc0f305-f626-49db-8869-10b87f201bba","882796ef-190b-405e-98ef-cb487140cf64"],"sitetemplate_id":null,"timezone":"America/Los_Angeles","tzoffset":960}]` + testHelper.KeysBodyMatcher(t, expected, apiResponse.Response.Body, false, false) +} diff --git a/mistapi/samples_webhooks.go b/mistapi/samples_webhooks.go index 61ca2aa0..c8efe24c 100644 --- a/mistapi/samples_webhooks.go +++ b/mistapi/samples_webhooks.go @@ -123,7 +123,7 @@ func (s *SamplesWebhooks) Audits( // ClientInfo takes context, body as parameters and // returns an *Response and // an error if there was an issue with the request or response. -// Webhook sample for `client_info` topic +// Webhook sample for `client-info` topic // **Note**: The server host will be your own server FQDN where the Mist Cloud is sending the webhook messages func (s *SamplesWebhooks) ClientInfo( ctx context.Context, diff --git a/mistapi/samples_webhooks_test.go b/mistapi/samples_webhooks_test.go index 90003eee..3e818e46 100644 --- a/mistapi/samples_webhooks_test.go +++ b/mistapi/samples_webhooks_test.go @@ -57,7 +57,7 @@ func TestSamplesWebhooksTestAudits(t *testing.T) { func TestSamplesWebhooksTestClientInfo(t *testing.T) { ctx := context.Background() var body models.WebhookClientInfo - errBody := json.Unmarshal([]byte(`{"events":[{"ap":"string","ap_name":"string","band":"string","bssid":"string","connect":0,"connect_float":0,"mac":"string","org_id":"a40f5d1f-d889-42e9-94ea-b9b33585fc6b","rssi":0,"site_id":"72771e6a-6f5e-4de4-a5b9-1266c4197811","site_name":"string","ssid":"string","timestamp":0,"version":0,"wlan_id":"5028e92b-fc59-4056-91d1-ea4b4ca1617a"}],"topic":"client-info"}`), &body) + errBody := json.Unmarshal([]byte(`{"events":[{"hostname":"service.company.net","ip":"21.0.128.151","mac":"6ebaa47a3fd4","org_id":"0c160b7f-1027-4cd1-923b-744534c4b070","site_id":"6e77a2ea-d579-471c-9056-5ff5b4ed70ed","timestamp":1703003296}],"topic":"client-info"}`), &body) if errBody != nil { t.Errorf("Cannot parse the model object.") } diff --git a/mistapi/sites_clients_wireless_test.go b/mistapi/sites_clients_wireless_test.go index b9bce64a..3398e1f1 100644 --- a/mistapi/sites_clients_wireless_test.go +++ b/mistapi/sites_clients_wireless_test.go @@ -136,7 +136,7 @@ func TestSitesClientsWirelessTestSearchSiteWirelessClients(t *testing.T) { testHelper.NewTestHeader(true,"Content-Type","application/json"), } testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) - expected := `{"end":17141231418.812,"limit":118,"next":"next8","results":[{"ap":["a83a79a947ee","003e73170b4c"],"app_version":["0.100.3"],"band":"5","device":["Mac"],"ftc":false,"hardware":"Apple Wi-Fi adapter","hostname":["hostname-a","hostname-b"],"ip":["10.5.23.43","192.168.0.2"],"last_ap":"a83a79a947ee","last_devuce":"Mac","last_firmware":"wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675","last_hostname":"hostname-a","last_ip":"10.5.23.43","last_model":"MBP 16\\\" M1 2021","last_os":"Sonoma","last_os_version":"14.4.1 (Build 23E224)","last_psk_id":"abf7dc5c-bb51-4bb7-93b6-5547400ffe11","last_psk_name":"iot","last_ssid":"IoT SSID","last_username":"user@corp.com","last_vlan":10,"last_wlan_id":"e5d67b07-aae8-494b-8584-cbc20c8110aa","mac":"bcd074000000","mfg":"Apple","model":"MBP 16\\\" M1 2021","org_id":"1abff1aa-4571-4c1f-a409-153a1e7a7a24","os":["Sonoma"],"os_version":["14.4.1 (Build 23E224)"],"protocol":"ax","psk_id":["abf7dc5c-bb51-4bb7-93b6-5547400ffe11"],"psk_name":["iot"],"sdk_version":["0.100.3"],"site_id":"25ff5219-9be7-4db9-907d-0c9b60445147","site_ids":["25ff5219-9be7-4db9-907d-0c9b60445147"],"ssid":["IoT SSID"],"timestamp":1714124722.113,"username":["user@corp.com"],"vlan":[10]}],"start":10,"total":44}` + expected := `{"end":17141231418.812,"limit":118,"next":"next8","results":[{"ap":["a83a79a947ee","003e73170b4c"],"app_version":["0.100.3"],"band":"5","device":["Mac"],"ftc":false,"hardware":"Apple Wi-Fi adapter","hostname":["hostname-a","hostname-b"],"ip":["10.5.23.43","192.168.0.2"],"last_ap":"a83a79a947ee","last_device":"Mac","last_firmware":"wl0: Jan 20 2024 04:08:41 version 20.103.12.0.8.7.171 FWID 01-e09d2675","last_hostname":"hostname-a","last_ip":"10.5.23.43","last_model":"MBP 16\\\" M1 2021","last_os":"Sonoma","last_os_version":"14.4.1 (Build 23E224)","last_psk_id":"abf7dc5c-bb51-4bb7-93b6-5547400ffe11","last_psk_name":"iot","last_ssid":"IoT SSID","last_username":"user@corp.com","last_vlan":10,"last_wlan_id":"e5d67b07-aae8-494b-8584-cbc20c8110aa","mac":"bcd074000000","mfg":"Apple","model":"MBP 16\\\" M1 2021","org_id":"1abff1aa-4571-4c1f-a409-153a1e7a7a24","os":["Sonoma"],"os_version":["14.4.1 (Build 23E224)"],"protocol":"ax","psk_id":["abf7dc5c-bb51-4bb7-93b6-5547400ffe11"],"psk_name":["iot"],"sdk_version":["0.100.3"],"site_id":"25ff5219-9be7-4db9-907d-0c9b60445147","site_ids":["25ff5219-9be7-4db9-907d-0c9b60445147"],"ssid":["IoT SSID"],"timestamp":1714124722.113,"username":["user@corp.com"],"vlan":[10]}],"start":10,"total":44}` testHelper.KeysBodyMatcher(t, expected, apiResponse.Response.Body, false, false) } diff --git a/mistapi/sites_stats_wx_rules.go b/mistapi/sites_stats_wx_rules.go index 216982ce..6bed3cbd 100644 --- a/mistapi/sites_stats_wx_rules.go +++ b/mistapi/sites_stats_wx_rules.go @@ -23,13 +23,13 @@ func NewSitesStatsWxRules(baseController baseController) *SitesStatsWxRules { } // GetSiteWxRulesUsage takes context, siteId as parameters and -// returns an models.ApiResponse with []models.StatsWrule data and +// returns an models.ApiResponse with []models.StatsWxrule data and // an error if there was an issue with the request or response. // Get Wxlan Rule usage func (s *SitesStatsWxRules) GetSiteWxRulesUsage( ctx context.Context, siteId uuid.UUID) ( - models.ApiResponse[[]models.StatsWrule], + models.ApiResponse[[]models.StatsWxrule], error) { req := s.prepareRequest( ctx, @@ -55,12 +55,12 @@ func (s *SitesStatsWxRules) GetSiteWxRulesUsage( "429": {Message: "Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold", Unmarshaller: errors.NewResponseHttp429Error}, }) - var result []models.StatsWrule + var result []models.StatsWxrule decoder, resp, err := req.CallAsJson() if err != nil { return models.NewApiResponse(result, resp), err } - result, err = utilities.DecodeResults[[]models.StatsWrule](decoder) + result, err = utilities.DecodeResults[[]models.StatsWxrule](decoder) return models.NewApiResponse(result, resp), err } diff --git a/mistapi/tests_base.go b/mistapi/tests_base.go index a2a93ac1..db415465 100644 --- a/mistapi/tests_base.go +++ b/mistapi/tests_base.go @@ -140,6 +140,8 @@ var orgsStatsOtherDevices OrgsStatsOtherDevices var orgsStatsPorts OrgsStatsPorts +var orgsStatsSites OrgsStatsSites + var orgsStatsTunnels OrgsStatsTunnels var orgsStatsVpnPeers OrgsStatsVPNPeers @@ -453,6 +455,7 @@ func init() { orgsStatsMxEdges = *client.OrgsStatsMxEdges() orgsStatsOtherDevices = *client.OrgsStatsOtherDevices() orgsStatsPorts = *client.OrgsStatsPorts() + orgsStatsSites = *client.OrgsStatsSites() orgsStatsTunnels = *client.OrgsStatsTunnels() orgsStatsVpnPeers = *client.OrgsStatsVPNPeers() orgsNacRules = *client.OrgsNACRules() diff --git a/mistapi/utilities_common.go b/mistapi/utilities_common.go index c62bbad7..b527ee15 100644 --- a/mistapi/utilities_common.go +++ b/mistapi/utilities_common.go @@ -679,7 +679,7 @@ func (u *UtilitiesCommon) CreateSiteDeviceShellSession( return models.NewApiResponse(result, resp), err } -// GetSiteDeviceArpTable takes context, siteId, deviceId, body as parameters and +// ShowSiteDeviceArpTable takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get ARP Table from the Device. @@ -691,7 +691,7 @@ func (u *UtilitiesCommon) CreateSiteDeviceShellSession( // "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" // } // ``` -func (u *UtilitiesCommon) GetSiteDeviceArpTable( +func (u *UtilitiesCommon) ShowSiteDeviceArpTable( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -736,7 +736,7 @@ func (u *UtilitiesCommon) GetSiteDeviceArpTable( return models.NewApiResponse(result, resp), err } -// GetSiteDeviceBgpSummary takes context, siteId, deviceId, body as parameters and +// ShowSiteDeviceBgpSummary takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get BGP Summary from SSR, SRX and Switch. @@ -745,7 +745,7 @@ func (u *UtilitiesCommon) GetSiteDeviceArpTable( // `WS /api-ws/v1/stream` // ```json // { -// \"subscribe\": \"/sites/{site_id}/devices/{device_id}/cmd\"\ +// "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" // } // ``` // ##### Example output from ws stream @@ -762,7 +762,7 @@ func (u *UtilitiesCommon) GetSiteDeviceArpTable( // Network Next Hop Metric LocPrf Weight Path // *> 161.161.161.0/24 // ```" -func (u *UtilitiesCommon) GetSiteDeviceBgpSummary( +func (u *UtilitiesCommon) ShowSiteDeviceBgpSummary( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -808,7 +808,7 @@ func (u *UtilitiesCommon) GetSiteDeviceBgpSummary( } // ShowSiteDeviceDhcpLeases takes context, siteId, deviceId, body as parameters and -// returns an models.ApiResponse with models.WebsocketSessionWithUrl data and +// returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Shows DHCP leases func (u *UtilitiesCommon) ShowSiteDeviceDhcpLeases( @@ -816,7 +816,7 @@ func (u *UtilitiesCommon) ShowSiteDeviceDhcpLeases( siteId uuid.UUID, deviceId uuid.UUID, body *models.UtilsShowDhcpLeases) ( - models.ApiResponse[models.WebsocketSessionWithUrl], + models.ApiResponse[models.WebsocketSession], error) { req := u.prepareRequest( ctx, @@ -846,21 +846,21 @@ func (u *UtilitiesCommon) ShowSiteDeviceDhcpLeases( req.Json(body) } - var result models.WebsocketSessionWithUrl + var result models.WebsocketSession decoder, resp, err := req.CallAsJson() if err != nil { return models.NewApiResponse(result, resp), err } - result, err = utilities.DecodeResults[models.WebsocketSessionWithUrl](decoder) + result, err = utilities.DecodeResults[models.WebsocketSession](decoder) return models.NewApiResponse(result, resp), err } -// GetSiteDeviceEvpnDatabase takes context, siteId, deviceId, body as parameters and +// ShowSiteDeviceEvpnDatabase takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get EVPN Database from the Device. The output will be available through websocket. -func (u *UtilitiesCommon) GetSiteDeviceEvpnDatabase( +func (u *UtilitiesCommon) ShowSiteDeviceEvpnDatabase( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -905,7 +905,7 @@ func (u *UtilitiesCommon) GetSiteDeviceEvpnDatabase( return models.NewApiResponse(result, resp), err } -// GetSiteDeviceForwardingTable takes context, siteId, deviceId, body as parameters and +// ShowSiteDeviceForwardingTable takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get forwarding table from the Device. The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, `session` is introduced for demux. @@ -920,7 +920,7 @@ func (u *UtilitiesCommon) GetSiteDeviceEvpnDatabase( // ``` // Mon 2024-05-20 16:47:30 UTC Retrieving fib entries… Entry Count: 3268 Capacity: 22668 ==================== ====== ======= ================== ===== ====================== =========== =========== ====== IP Prefix Port Proto Tenant VRF Service Next Hops Vector Cost ==================== ====== ======= ================== ===== ====================== =========== =========== ====== 0.0.0.0/0 0 None Old_Mgmt - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-Kiosk - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-MGT - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 3.1.1.0/24 0 None Old_Mgmt - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-Kiosk - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 branch1-MGT - internet-wan_and_lte 1-2.0 broadband 1 1-4.0 lte 10 // ``` -func (u *UtilitiesCommon) GetSiteDeviceForwardingTable( +func (u *UtilitiesCommon) ShowSiteDeviceForwardingTable( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -965,7 +965,7 @@ func (u *UtilitiesCommon) GetSiteDeviceForwardingTable( return models.NewApiResponse(result, resp), err } -// GetSiteDeviceMacTable takes context, siteId, deviceId, body as parameters and +// ShowSiteDeviceMacTable takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get MAC Table from the Device. @@ -977,7 +977,7 @@ func (u *UtilitiesCommon) GetSiteDeviceForwardingTable( // "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" // } // ``` -func (u *UtilitiesCommon) GetSiteDeviceMacTable( +func (u *UtilitiesCommon) ShowSiteDeviceMacTable( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -1027,15 +1027,16 @@ func (u *UtilitiesCommon) GetSiteDeviceMacTable( // an error if there was an issue with the request or response. // Support / Upload device support files // #### Info Param -// **Parameter**|**Description** -// :-------------: |:-------------: |:-------------: -// process|Upload 1 file with output of show system processes extensive -// outbound-ssh|Upload 1 file that concatenates all /var/log/outbound-ssh.log* files -// messages|Upload 1 to 10 /var/log/messages* files -// core-dumps|Upload all core dump files, if any -// full|string|Upload 1 file with output of request support information, 1 file that concatenates all /var/log/outbound-ssh.log files, all core dump files, the 3 most recent /var/log/messages files, and Mist agent logs (for Junos devices running the Mist agent) -// var-logs|Upload all non-empty files in the /var/log/ directory -// jma-logs|Upload Mist agent logs (for Junos devices running the Mist agent only) +// | Name | Type | Description | +// | --- | --- | --- | +// | process | string | Upload 1 file with output of show system processes extensive | +// | outbound-ssh | string | Upload 1 file that concatenates all /var/log/outbound-ssh.log* files | +// | messages | string | Upload 1 to 10 /var/log/messages* files | +// | core-dumps | string | Upload all core dump files, if any | +// | full | string | Upload 1 file with output of request support information, 1 file that concatenates all /var/log/outbound-ssh.log files, all core dump files, the 3 most recent /var/log/messages files, and Mist agent logs (for Junos devices running the Mist agent) | +// | var-logs | string | Upload all non-empty files in the /var/log/ directory | +// | jma-logs | string | Upload Mist agent logs (for Junos devices running the Mist agent only) | +// " func (u *UtilitiesCommon) UploadSiteDeviceSupportFile( ctx context.Context, siteId uuid.UUID, @@ -1082,14 +1083,25 @@ func (u *UtilitiesCommon) UploadSiteDeviceSupportFile( // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Traceroute can be performed from the Device. -// The output will be available through websocket. As there can be multiple command issued against the same AP at the same time and the output all goes through the same websocket stream, session is introduced for demux. +// The output will be available through websocket. As there can be multiple command issued against the same Device at the same time and the output all goes through the same websocket stream, session is introduced for demux. // #### Subscribe to Device Command outputs // `WS /api-ws/v1/stream` // ```json // { // "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +// }``` +// #### Example output from ws stream +// ```json +// { +// "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", +// "event": "data", +// "data": { +// "session": "9106e908-74dc-4a4f-9050-9c2adcaf44a5", +// "raw": "Running traceroute...\ntraceroute to 8.8.8.8, 64 hops max\n 0 192.168.1.1 1 ms 192.168.1.1 1 ms 192.168.1.1 1 ms\n 1 80.10.236.81 2 ms 80.10.236.81 4 ms 80.10.236.81 2 ms\n 2 193.253.80.250 3 ms 193.253.80.250 2 ms 193.253.80.250 2 ms\n 3 193.252.159.41 2 ms 193.252.159.41 1 ms 193.252.159.41 3 ms\n" +// } // } // ``` +// " func (u *UtilitiesCommon) TracerouteFromDevice( ctx context.Context, siteId uuid.UUID, diff --git a/mistapi/utilities_common_test.go b/mistapi/utilities_common_test.go index f978b8e5..c52018a9 100644 --- a/mistapi/utilities_common_test.go +++ b/mistapi/utilities_common_test.go @@ -299,8 +299,8 @@ func TestUtilitiesCommonTestCreateSiteDeviceShellSession(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesCommonTestGetSiteDeviceArpTable tests the behavior of the UtilitiesCommon -func TestUtilitiesCommonTestGetSiteDeviceArpTable(t *testing.T) { +// TestUtilitiesCommonTestShowSiteDeviceArpTable tests the behavior of the UtilitiesCommon +func TestUtilitiesCommonTestShowSiteDeviceArpTable(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -311,7 +311,7 @@ func TestUtilitiesCommonTestGetSiteDeviceArpTable(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesCommon.GetSiteDeviceArpTable(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesCommon.ShowSiteDeviceArpTable(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -322,8 +322,8 @@ func TestUtilitiesCommonTestGetSiteDeviceArpTable(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesCommonTestGetSiteDeviceBgpSummary tests the behavior of the UtilitiesCommon -func TestUtilitiesCommonTestGetSiteDeviceBgpSummary(t *testing.T) { +// TestUtilitiesCommonTestShowSiteDeviceBgpSummary tests the behavior of the UtilitiesCommon +func TestUtilitiesCommonTestShowSiteDeviceBgpSummary(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -334,7 +334,7 @@ func TestUtilitiesCommonTestGetSiteDeviceBgpSummary(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesCommon.GetSiteDeviceBgpSummary(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesCommon.ShowSiteDeviceBgpSummary(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -368,8 +368,8 @@ func TestUtilitiesCommonTestShowSiteDeviceDhcpLeases(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesCommonTestGetSiteDeviceEvpnDatabase tests the behavior of the UtilitiesCommon -func TestUtilitiesCommonTestGetSiteDeviceEvpnDatabase(t *testing.T) { +// TestUtilitiesCommonTestShowSiteDeviceEvpnDatabase tests the behavior of the UtilitiesCommon +func TestUtilitiesCommonTestShowSiteDeviceEvpnDatabase(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -380,7 +380,7 @@ func TestUtilitiesCommonTestGetSiteDeviceEvpnDatabase(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesCommon.GetSiteDeviceEvpnDatabase(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesCommon.ShowSiteDeviceEvpnDatabase(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -391,8 +391,8 @@ func TestUtilitiesCommonTestGetSiteDeviceEvpnDatabase(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesCommonTestGetSiteDeviceForwardingTable tests the behavior of the UtilitiesCommon -func TestUtilitiesCommonTestGetSiteDeviceForwardingTable(t *testing.T) { +// TestUtilitiesCommonTestShowSiteDeviceForwardingTable tests the behavior of the UtilitiesCommon +func TestUtilitiesCommonTestShowSiteDeviceForwardingTable(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -403,7 +403,7 @@ func TestUtilitiesCommonTestGetSiteDeviceForwardingTable(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesCommon.GetSiteDeviceForwardingTable(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesCommon.ShowSiteDeviceForwardingTable(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -414,8 +414,8 @@ func TestUtilitiesCommonTestGetSiteDeviceForwardingTable(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesCommonTestGetSiteDeviceMacTable tests the behavior of the UtilitiesCommon -func TestUtilitiesCommonTestGetSiteDeviceMacTable(t *testing.T) { +// TestUtilitiesCommonTestShowSiteDeviceMacTable tests the behavior of the UtilitiesCommon +func TestUtilitiesCommonTestShowSiteDeviceMacTable(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -426,7 +426,7 @@ func TestUtilitiesCommonTestGetSiteDeviceMacTable(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesCommon.GetSiteDeviceMacTable(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesCommon.ShowSiteDeviceMacTable(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } diff --git a/mistapi/utilities_pca_ps.go b/mistapi/utilities_pca_ps.go index 14ef129f..010ff167 100644 --- a/mistapi/utilities_pca_ps.go +++ b/mistapi/utilities_pca_ps.go @@ -174,7 +174,7 @@ func (u *UtilitiesPCAPs) GetOrgCapturingStatus( // `WS /api-ws/v1/stream` // ```json // { -// subscribe: "/sites/{site_id}/pcaps" +// "subscribe": "/sites/{site_id}/pcaps" // } // ``` // #### Response (Wireless/RadioTap) @@ -408,7 +408,7 @@ func (u *UtilitiesPCAPs) GetSiteCapturingStatus( // `WS /api-ws/v1/stream` // ```json // { -// subscribe: "/sites/{site_id}/pcaps" +// "subscribe": "/sites/{site_id}/pcaps" // } // ``` // #### Response (MxEdge) @@ -440,7 +440,7 @@ func (u *UtilitiesPCAPs) GetSiteCapturingStatus( // "pcap_raw": "1MOyoQIABAAAAAAAAAAAAP//AAABAAAAEEh7Yh5VBwCgAQAAoAEAAAAAKwBvCADAAQAAAIw7reCS2VNkAAAAABACbAmABLWuAAEAEBgAAwACAABQADoBeL28ygsKGLgfTJHAGLgfTJHAcIZ2WDlBJQAAAGQAERUACkFUVEttc1dpVlMBCIKEi5YkMEhsAwECBwZVUyABCx4gAQAjAhkAKgEEMgQMEhhgMBQBAAAPrAQBAAAPrAQBAAAPrAIMAAsFAQAbAABGBTIIAQAALRqtCR////8AAAAAAAAAAAAAAAAAAAAAAAAAAD0WAggVAAAAAAAAAAAAAAAAAAAAAAAAAH8IBAAIAAAAAEDdkwBQ8gQQSgABEBBEAAECEDsAAQMQRwAQn2481frn3KT+uGod2ERx+RAhAAtBcnJpcywgSW5jLhAjAApCR1cyMTAtNzAwECQACkJHVzIxMC03MDAQQgAKQkdXMjEwLTcwMBBUAAgABgBQ8gQAARARAA5BcnJpcyBXaXJlbGVzcxAIAAIgCBA8AAEBEEkABgA3KgABIN0JABAYAgEQHAAA3RgAUPICAQGEAAOkAAAnpAAAQkNeAGIyLwAzjakr" // } // ``` -// #### vResponse (Wired) +// #### Response (Wired) // ```json // { // "event": "data" diff --git a/mistapi/utilities_wan.go b/mistapi/utilities_wan.go index 850af24f..3fc6d96e 100644 --- a/mistapi/utilities_wan.go +++ b/mistapi/utilities_wan.go @@ -170,15 +170,34 @@ func (u *UtilitiesWAN) ClearSiteDeviceSession( } // ReleaseSiteSsrDhcpLease takes context, siteId, deviceId, body as parameters and -// returns an *Response and +// returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Releases an active DHCP lease. +// The output will be available through websocket. As there can be multiple command issued against the same Device at the same time and the output all goes through the same websocket stream, session is introduced for demux. +// #### Subscribe to Device Command outputs +// `WS /api-ws/v1/stream` +// ```json +// { +// "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" +// }``` +// #### Example output from ws stream +// ```json +// { +// "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", +// "event": "data", +// "data": { +// "session": "9106e908-74dc-4a4f-9050-9c2adcaf44a5", +// "raw": "Running traceroute...\ntraceroute to 8.8.8.8, 64 hops max\n 0 192.168.1.1 1 ms 192.168.1.1 1 ms 192.168.1.1 1 ms\n 1 80.10.236.81 2 ms 80.10.236.81 4 ms 80.10.236.81 2 ms\n 2 193.253.80.250 3 ms 193.253.80.250 2 ms 193.253.80.250 2 ms\n 3 193.252.159.41 2 ms 193.252.159.41 1 ms 193.252.159.41 3 ms\n" +// } +// } +// ``` +// " func (u *UtilitiesWAN) ReleaseSiteSsrDhcpLease( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, body *models.UtilsReleaseDhcp) ( - *http.Response, + models.ApiResponse[models.WebsocketSession], error) { req := u.prepareRequest( ctx, @@ -208,11 +227,14 @@ func (u *UtilitiesWAN) ReleaseSiteSsrDhcpLease( req.Json(body) } - httpCtx, err := req.Call() + var result models.WebsocketSession + decoder, resp, err := req.CallAsJson() if err != nil { - return httpCtx.Response, err + return models.NewApiResponse(result, resp), err } - return httpCtx.Response, err + + result, err = utilities.DecodeResults[models.WebsocketSession](decoder) + return models.NewApiResponse(result, resp), err } // TestSiteSsrDnsResolution takes context, siteId, deviceId as parameters and @@ -393,7 +415,7 @@ func (u *UtilitiesWAN) ServicePingFromSsr( return models.NewApiResponse(result, resp), err } -// GetSiteSsrOspfDatabase takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrOspfDatabase takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get OSPF Database from the Device. The output will be available through websocket. @@ -415,7 +437,7 @@ func (u *UtilitiesWAN) ServicePingFromSsr( // 1.0.0.3 1 Full 852 38 172.16.4.2 Backup // 1.0.0.4 1 Full 811 34 172.16.4.2 DROther // ``` -func (u *UtilitiesWAN) GetSiteSsrOspfDatabase( +func (u *UtilitiesWAN) ShowSiteSsrOspfDatabase( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -460,7 +482,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfDatabase( return models.NewApiResponse(result, resp), err } -// GetSiteSsrOspfInterface takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrOspfInterfaces takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get OSPF interfaces from the Device. The output will be available through websocket. @@ -481,7 +503,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfDatabase( // net3 g3 True 172.16.3.2/24 Broadcast 0.0.0.0 default // net4 g4 True 172.16.4.2/24 Broadcast 0.0.0.4 default // ``` -func (u *UtilitiesWAN) GetSiteSsrOspfInterface( +func (u *UtilitiesWAN) ShowSiteSsrOspfInterfaces( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -526,7 +548,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfInterface( return models.NewApiResponse(result, resp), err } -// GetSiteSsrOspfNeighbors takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrOspfNeighbors takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get OSPF Neighbors from the Device. The output will be available through websocket. @@ -548,7 +570,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfInterface( // 1.0.0.3 1 Full 852 38 172.16.4.2 Backup // 1.0.0.4 1 Full 811 34 172.16.4.2 DROther // ``` -func (u *UtilitiesWAN) GetSiteSsrOspfNeighbors( +func (u *UtilitiesWAN) ShowSiteSsrOspfNeighbors( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -593,7 +615,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfNeighbors( return models.NewApiResponse(result, resp), err } -// GetSiteSsrOspfSummary takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrOspfSummary takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get OSPF summary from the Device. The output will be available through websocket. @@ -614,7 +636,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfNeighbors( // 1.0.0.2 cisco False 0 0.0.0.0 // 1.0.0.2 cisco False 0 0.0.0.4 default // ``` -func (u *UtilitiesWAN) GetSiteSsrOspfSummary( +func (u *UtilitiesWAN) ShowSiteSsrOspfSummary( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -659,7 +681,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfSummary( return models.NewApiResponse(result, resp), err } -// GetSiteSsrAndSrxRoutes takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrAndSrxRoutes takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get routes from SSR, SRX and Switch. @@ -690,7 +712,7 @@ func (u *UtilitiesWAN) GetSiteSsrOspfSummary( // none // ... // ``` -func (u *UtilitiesWAN) GetSiteSsrAndSrxRoutes( +func (u *UtilitiesWAN) ShowSiteSsrAndSrxRoutes( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -735,31 +757,17 @@ func (u *UtilitiesWAN) GetSiteSsrAndSrxRoutes( return models.NewApiResponse(result, resp), err } -// GetSiteSsrServicePath takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrServicePath takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get service path information of the Device. // The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. // #### Subscribe to Device Command outputs // `WS /api-ws/v1/stream` -// ```json -// { -// "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -// } -// ``` -// ##### Example output from ws stream -// ``` -// show service_path -// Service Service-route Type Destination Next-Hop Interface Vector Cost Rate Capacity State -// Web web-route1 service_agent 4.4.4.4 1.1.1.2 lan red 10 1 200/3000 Up* -// Web web-route1 service_agent 4.4.4.4 1.1.1.3 lan red 10 1 200/3000 Up -// Web web-route2 service_agent 5.5.5.5 2.2.2.2 lan blue 20 2 50/unlimited Down -// Login BgpOverSVR 10.1.1.1 1.2.3.4 wan red 10 3 - Up -// Login BgpOverSVR 11.1.1.1 1.2.3.4 wan red 10 1 - Up -// App1 Routed - - - - - - - - -// App1 learned-routed Routed - - - - - - - - -// ``` -func (u *UtilitiesWAN) GetSiteSsrServicePath( +// ```json { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" } ``` +// #### Example output from ws stream +// ```json { "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", "event": "data", "data": { "session":"5cb8a6db-d11a-42cd-bed7-19e9f29e637", "raw":"{\"status\":\"SUCCESS\",\"finished\":true,\"rows\":[{\"service\":\"management\",\"type\":\"service-agent\",\"network_interface\":\"ge-0/0/0\",\"destination\":\"\",\"gateway_ip\":\"192.168.1.1\",\"vector\":\"\",\"cost\":0,\"rate\":0,\"state\":\"Up\",\"capacity\":\"0/unlimited\",\"meetsSLA\":\"Yes\"},{\"service\":\"management\",\"type\":\"service-agent\",\"network_interface\":\"ge-0/0/1\",\"destination\":\"\",\"gateway_ip\":\"192.168.0.1\",\"vector\":\"\",\"cost\":0,\"rate\":0,\"state\":\"Up\",\"capacity\":\"0/unlimited\",\"meetsSLA\":\"Yes\"}]}" } } ``` +func (u *UtilitiesWAN) ShowSiteSsrServicePath( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, @@ -804,55 +812,17 @@ func (u *UtilitiesWAN) GetSiteSsrServicePath( return models.NewApiResponse(result, resp), err } -// GetSiteSsrAndSrxSessions takes context, siteId, deviceId, body as parameters and +// ShowSiteSsrAndSrxSessions takes context, siteId, deviceId, body as parameters and // returns an models.ApiResponse with models.WebsocketSession data and // an error if there was an issue with the request or response. // Get active sessions passing through the Device. // The output will be available through websocket. As there can be multiple command issued against the same device at the same time and the output all goes through the same websocket stream, session is introduced for demux. // #### Subscribe to Device Command outputs // `WS /api-ws/v1/stream` -// ```json -// { -// "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" -// } -// ``` -// ##### Example output from ws stream -// ```console -// admin@ssr.node# show sessions -// Fri 2020-04-17 16:55:34 UTC -// Node: node1 -// ====================================== ===== ============= =========== ========== ====== ======= ================= ========== ================= =========== ================= ========== =================== ========= ================= -// Session Id Dir Service Tenant Dev Name VLAN Proto Src IP Src Port Dest IP Dest Port NAT IP NAT Port Payload Encrypted Timeout Uptime -// ====================================== ===== ============= =========== ========== ====== ======= ================= ========== ================= =========== ================= ========== =================== ========= ================= -// 01187fb8-765a-45e5-ae90-37d77f15e292 fwd Internet lanSubnet lan 0 udp 192.168.0.28 44674 35.166.173.18 9930 96.230.191.130 19569 false 154 0 days 0:00:28 -// 01187fb8-765a-45e5-ae90-37d77f15e292 rev Internet lanSubnet wan 0 udp 35.166.173.18 9930 96.230.191.130 19569 0.0.0.0 0 false 154 0 days 0:00:28 -// 0859a4ae-bcff-4aa6-b812-79a5236a6c13 fwd Internet lanSubnet lan 0 tcp 192.168.0.41 60843 17.249.171.246 443 96.230.191.130 51941 false 2 0 days 0:00:10 -// admin@node0.90ec7732e327# show sessions by-id 262900cd-bca8-443a-8aab-e5c93d147ab5 -// Wed 2024-06-26 20:37:48 UTC -// Retrieving session information... -// ======================================================================================================================================================================================= -// 90ec7732e327.node0 Session ID: 262900cd-bca8-443a-8aab-e5c93d147ab5 -// ======================================================================================================================================================================================= -// Service Name: Internet -// Service Route Name: Internet-sr-local-breakout-1-node0 -// Session Source: SourceType: PUBLIC -// Session Type: HTTPS -// Service Class: service-class-0-low -// Source Tenant: LAN -// Peer Name: N/A -// Inter Node: N/A -// Inter Router: N/A -// Ingress Source Nat: N/A -// Payload Security Policy: internal -// Payload Encrypted: True -// Common Name Info: N/A -// Tcp Time To Establish: 76 -// Tls Time To Establish: 76 -// Domain Name: N/A -// Uri: N/A -// Category: N/A -// ```" -func (u *UtilitiesWAN) GetSiteSsrAndSrxSessions( +// ```json { "subscribe": "/sites/{site_id}/devices/{device_id}/cmd" }``` +// #### Example output from ws stream +// ```json { "channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd", "event": "data", "data": { "session": "f517bf29-1141-41ae-a084-17cacb0ccb57", "raw": "{\"status\":\"SUCCESS\",\"finished\":true,\"rows\":[{\"session_id\":\"a04b1cc7-dcc1-40a6-a010-0fe46ca38551\",\"direction\":\"forward\",\"service\":\"internet\",\"tenant\":\"SRV.PRD-Core\",\"device_interface\":\"ge-0/0/3\",\"network_interface\":\"ge-0/0/3.100\",\"protocol\":\"TCP\",\"source_ip\":\"10.3.20.101\",\"source_port\":45733,\"destination_ip\":\"13.38.46.35\",\"destination_port\":443,\"nat_ip\":\"192.168.1.115\",\"nat_port\":45256,\"payload_encrypted\":false,\"timeout\":1581,\"uptime\":319},{\"session_id\":\"a04b1cc7-dcc1-40a6-a010-0fe46ca38551\",\"direction\":\"reverse\",\"service\":\"internet\",\"tenant\":\"SRV.PRD-Core\",\"device_interface\":\"ge-0/0/0\",\"network_interface\":\"ge-0/0/0\",\"protocol\":\"TCP\",\"source_ip\":\"13.38.46.35\",\"source_port\":443,\"destination_ip\":\"192.168.1.115\",\"destination_port\":45256,\"nat_ip\":\"0.0.0.0\",\"nat_port\":0,\"payload_encrypted\":false,\"timeout\":1581,\"uptime\":319}]}\n" } } ``` +func (u *UtilitiesWAN) ShowSiteSsrAndSrxSessions( ctx context.Context, siteId uuid.UUID, deviceId uuid.UUID, diff --git a/mistapi/utilities_wan_test.go b/mistapi/utilities_wan_test.go index 2093d3b0..c03887ba 100644 --- a/mistapi/utilities_wan_test.go +++ b/mistapi/utilities_wan_test.go @@ -98,11 +98,15 @@ func TestUtilitiesWANTestReleaseSiteSsrDhcpLease(t *testing.T) { if errBody != nil { t.Errorf("Cannot parse the model object.") } - resp, err := utilitiesWan.ReleaseSiteSsrDhcpLease(ctx, siteId, deviceId, &body) + apiResponse, err := utilitiesWan.ReleaseSiteSsrDhcpLease(ctx, siteId, deviceId, &body) if err != nil { t.Errorf("Endpoint call failed: %v", err) } - testHelper.CheckResponseStatusCode(t, resp.StatusCode, 200) + testHelper.CheckResponseStatusCode(t, apiResponse.Response.StatusCode, 200) + expectedHeaders:= []testHelper.TestHeader{ + testHelper.NewTestHeader(true,"Content-Type","application/json"), + } + testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } // TestUtilitiesWANTestTestSiteSsrDnsResolution tests the behavior of the UtilitiesWAN @@ -176,8 +180,8 @@ func TestUtilitiesWANTestServicePingFromSsr(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrOspfDatabase tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrOspfDatabase(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrOspfDatabase tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrOspfDatabase(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -188,7 +192,7 @@ func TestUtilitiesWANTestGetSiteSsrOspfDatabase(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesWan.GetSiteSsrOspfDatabase(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesWan.ShowSiteSsrOspfDatabase(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -199,8 +203,8 @@ func TestUtilitiesWANTestGetSiteSsrOspfDatabase(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrOspfInterface tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrOspfInterface(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrOspfInterfaces tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrOspfInterfaces(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -211,7 +215,7 @@ func TestUtilitiesWANTestGetSiteSsrOspfInterface(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesWan.GetSiteSsrOspfInterface(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesWan.ShowSiteSsrOspfInterfaces(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -222,8 +226,8 @@ func TestUtilitiesWANTestGetSiteSsrOspfInterface(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrOspfNeighbors tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrOspfNeighbors(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrOspfNeighbors tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrOspfNeighbors(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -234,7 +238,7 @@ func TestUtilitiesWANTestGetSiteSsrOspfNeighbors(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesWan.GetSiteSsrOspfNeighbors(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesWan.ShowSiteSsrOspfNeighbors(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -245,8 +249,8 @@ func TestUtilitiesWANTestGetSiteSsrOspfNeighbors(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrOspfSummary tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrOspfSummary(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrOspfSummary tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrOspfSummary(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -257,7 +261,7 @@ func TestUtilitiesWANTestGetSiteSsrOspfSummary(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesWan.GetSiteSsrOspfSummary(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesWan.ShowSiteSsrOspfSummary(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -268,8 +272,8 @@ func TestUtilitiesWANTestGetSiteSsrOspfSummary(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrAndSrxRoutes tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrAndSrxRoutes(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrAndSrxRoutes tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrAndSrxRoutes(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -280,7 +284,7 @@ func TestUtilitiesWANTestGetSiteSsrAndSrxRoutes(t *testing.T) { t.Error(errUUID) } - apiResponse, err := utilitiesWan.GetSiteSsrAndSrxRoutes(ctx, siteId, deviceId, nil) + apiResponse, err := utilitiesWan.ShowSiteSsrAndSrxRoutes(ctx, siteId, deviceId, nil) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -291,8 +295,8 @@ func TestUtilitiesWANTestGetSiteSsrAndSrxRoutes(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrServicePath tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrServicePath(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrServicePath tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrServicePath(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -307,7 +311,7 @@ func TestUtilitiesWANTestGetSiteSsrServicePath(t *testing.T) { if errBody != nil { t.Errorf("Cannot parse the model object.") } - apiResponse, err := utilitiesWan.GetSiteSsrServicePath(ctx, siteId, deviceId, &body) + apiResponse, err := utilitiesWan.ShowSiteSsrServicePath(ctx, siteId, deviceId, &body) if err != nil { t.Errorf("Endpoint call failed: %v", err) } @@ -318,8 +322,8 @@ func TestUtilitiesWANTestGetSiteSsrServicePath(t *testing.T) { testHelper.CheckResponseHeaders(t, apiResponse.Response.Header, expectedHeaders, true) } -// TestUtilitiesWANTestGetSiteSsrAndSrxSessions tests the behavior of the UtilitiesWAN -func TestUtilitiesWANTestGetSiteSsrAndSrxSessions(t *testing.T) { +// TestUtilitiesWANTestShowSiteSsrAndSrxSessions tests the behavior of the UtilitiesWAN +func TestUtilitiesWANTestShowSiteSsrAndSrxSessions(t *testing.T) { ctx := context.Background() siteId, errUUID := uuid.Parse("000000ab-00ab-00ab-00ab-0000000000ab") if errUUID != nil { @@ -334,7 +338,7 @@ func TestUtilitiesWANTestGetSiteSsrAndSrxSessions(t *testing.T) { if errBody != nil { t.Errorf("Cannot parse the model object.") } - apiResponse, err := utilitiesWan.GetSiteSsrAndSrxSessions(ctx, siteId, deviceId, &body) + apiResponse, err := utilitiesWan.ShowSiteSsrAndSrxSessions(ctx, siteId, deviceId, &body) if err != nil { t.Errorf("Endpoint call failed: %v", err) }