(Settings)
Server configuration
- GetAllSettings - List all settings
- GetAllowedNetworks - Get allowed networks for a policy server
- SetAllowedNetworks - Set allowed networks for a policy server
- ModifyAllowedNetworks - Modify allowed networks for a policy server
- GetSetting - Get the value of a setting
- ModifySetting - Set the value of a setting
Get the current value of all the settings
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
ctx := context.Background()
res, err := s.Settings.GetAllSettings(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
*operations.GetAllSettingsResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Get the list of allowed networks for a policy server
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var nodeID string = "9a1773c9-0889-40b6-be89-f6504443ac1b"
ctx := context.Background()
res, err := s.Settings.GetAllowedNetworks(ctx, nodeID)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
nodeID |
string | ✔️ | Policy server ID for which you want to manage allowed networks. | 9a1773c9-0889-40b6-be89-f6504443ac1b |
*operations.GetAllowedNetworksResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Set the list of allowed networks for a policy server
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"github.com/infra-rdc/rudder-go/models/operations"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var nodeID string = "9a1773c9-0889-40b6-be89-f6504443ac1b"
requestBody := operations.SetAllowedNetworksRequestBody{
Value: &operations.Value{},
}
ctx := context.Background()
res, err := s.Settings.SetAllowedNetworks(ctx, nodeID, requestBody)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
nodeID |
string | ✔️ | Policy server ID for which you want to manage allowed networks. | 9a1773c9-0889-40b6-be89-f6504443ac1b |
requestBody |
operations.SetAllowedNetworksRequestBody | ✔️ | N/A |
*operations.SetAllowedNetworksResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Add or delete allowed networks for a policy server
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"github.com/infra-rdc/rudder-go/models/operations"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var nodeID string = "9a1773c9-0889-40b6-be89-f6504443ac1b"
requestBody := operations.ModifyAllowedNetworksRequestBody{
AllowedNetworks: &operations.AllowedNetworks{
Add: []string{
"192.168.2.0/24",
"192.168.0.0/16",
},
Delete: []string{
"162.168.1.0/24",
},
},
}
ctx := context.Background()
res, err := s.Settings.ModifyAllowedNetworks(ctx, nodeID, requestBody)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
nodeID |
string | ✔️ | Policy server ID for which you want to manage allowed networks. | 9a1773c9-0889-40b6-be89-f6504443ac1b |
requestBody |
operations.ModifyAllowedNetworksRequestBody | ✔️ | N/A |
*operations.ModifyAllowedNetworksResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Get the current value of a specific setting
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var settingID string = "global_policy_mode"
ctx := context.Background()
res, err := s.Settings.GetSetting(ctx, settingID)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
settingID |
string | ✔️ | Id of the setting to set | global_policy_mode |
*operations.GetSettingResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Set the current value of a specific setting
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"github.com/infra-rdc/rudder-go/models/operations"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var settingID string = "global_policy_mode"
requestBody := operations.ModifySettingRequestBody{
Value: rudder.String("enforce"),
}
ctx := context.Background()
res, err := s.Settings.ModifySetting(ctx, settingID, requestBody)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
settingID |
string | ✔️ | Id of the setting to set | global_policy_mode |
requestBody |
operations.ModifySettingRequestBody | ✔️ | N/A |
*operations.ModifySettingResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |