(Archives)
Import and export zip of policies
- Export - Get a ZIP archive of the requested items and their dependencies
- Import - Import a ZIP archive of policies into Rudder
Get a ZIP archive or rules, directives, techniques and groups with optionally their dependencies
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>"),
)
request := operations.ExportRequest{}
ctx := context.Background()
res, err := s.Archives.Export(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Stream != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ExportRequest | ✔️ | The request object to use for the request. |
*operations.ExportResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Import a ZIP archive of techniques, directives, groups and rules in a saved in a normalized format into Rudder
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 request *operations.ImportRequestBody = &operations.ImportRequestBody{}
ctx := context.Background()
res, err := s.Archives.Import(ctx, request)
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. |
request |
operations.ImportRequestBody | ✔️ | The request object to use for the request. |
*operations.ImportResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |