Skip to content

Latest commit

 

History

History
316 lines (242 loc) · 16.8 KB

README.md

File metadata and controls

316 lines (242 loc) · 16.8 KB

Settings

(Settings)

Overview

Server configuration

Available Operations

GetAllSettings

Get the current value of all the settings

Example Usage

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
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.

Response

*operations.GetAllSettingsResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

GetAllowedNetworks

Get the list of allowed networks for a policy server

Example Usage

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
    }
}

Parameters

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

Response

*operations.GetAllowedNetworksResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

SetAllowedNetworks

Set the list of allowed networks for a policy server

Example Usage

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
    }
}

Parameters

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

Response

*operations.SetAllowedNetworksResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

ModifyAllowedNetworks

Add or delete allowed networks for a policy server

Example Usage

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
    }
}

Parameters

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

Response

*operations.ModifyAllowedNetworksResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

GetSetting

Get the current value of a specific setting

Example Usage

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
    }
}

Parameters

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

Response

*operations.GetSettingResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

ModifySetting

Set the current value of a specific setting

Example Usage

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
    }
}

Parameters

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

Response

*operations.ModifySettingResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /