Skip to content

Latest commit

 

History

History
105 lines (79 loc) · 4.44 KB

README.md

File metadata and controls

105 lines (79 loc) · 4.44 KB

Archives

(Archives)

Overview

Import and export zip of policies

Available Operations

  • Export - Get a ZIP archive of the requested items and their dependencies
  • Import - Import a ZIP archive of policies into Rudder

Export

Get a ZIP archive or rules, directives, techniques and groups with optionally their dependencies

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>"),
    )
    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
    }
}

Parameters

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.

Response

*operations.ExportResponse, error

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

Import

Import a ZIP archive of techniques, directives, groups and rules in a saved in a normalized format into Rudder

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

Parameters

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.

Response

*operations.ImportResponse, error

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