Files
sdk/docs/GatewayAPI.md

5.2 KiB

\GatewayAPI

All URIs are relative to https://api.hanzo.ai

Method HTTP request Description
GatewayTraffic Get /v1/gateway/traffic Report who is calling this org's API right now
GetGatewayConfig Get /v1/gateway/config Returns the EFFECTIVE edge policy the caller is subject to: the platform CORS allowlist and pre-auth per-IP flood cap in force, plus the caller's own authenticated rate ceiling, edge-cache TTLs and accepted-method allowlist.
PutGatewayConfig Put /v1/gateway/config Updates one policy scope and returns the policy in force after the write.

GatewayTraffic

GatewayTrafficView GatewayTraffic(ctx).Execute()

Report who is calling this org's API right now

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.GatewayAPI.GatewayTraffic(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `GatewayAPI.GatewayTraffic``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GatewayTraffic`: GatewayTrafficView
	fmt.Fprintf(os.Stdout, "Response from `GatewayAPI.GatewayTraffic`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGatewayTrafficRequest struct via the builder pattern

Return type

GatewayTrafficView

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetGatewayConfig

GatewayPolicy GetGatewayConfig(ctx).Execute()

Returns the EFFECTIVE edge policy the caller is subject to: the platform CORS allowlist and pre-auth per-IP flood cap in force, plus the caller's own authenticated rate ceiling, edge-cache TTLs and accepted-method allowlist.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.GatewayAPI.GetGatewayConfig(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `GatewayAPI.GetGatewayConfig``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetGatewayConfig`: GatewayPolicy
	fmt.Fprintf(os.Stdout, "Response from `GatewayAPI.GetGatewayConfig`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetGatewayConfigRequest struct via the builder pattern

Return type

GatewayPolicy

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PutGatewayConfig

GatewayPolicy PutGatewayConfig(ctx).GatewayPolicy(gatewayPolicy).Execute()

Updates one policy scope and returns the policy in force after the write.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	gatewayPolicy := *openapiclient.NewGatewayPolicy() // GatewayPolicy | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.GatewayAPI.PutGatewayConfig(context.Background()).GatewayPolicy(gatewayPolicy).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `GatewayAPI.PutGatewayConfig``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PutGatewayConfig`: GatewayPolicy
	fmt.Fprintf(os.Stdout, "Response from `GatewayAPI.PutGatewayConfig`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiPutGatewayConfigRequest struct via the builder pattern

Name Type Description Notes
gatewayPolicy GatewayPolicy

Return type

GatewayPolicy

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]