(Directives)
Directives management
- ListDirectives - List all directives
- CreateDirective - Create a directive
- DirectiveDetails - Get directive details
- DeleteDirective - Delete a directive
List all directives
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.Directives.ListDirectives(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.ListDirectivesResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Create a new directive from provided parameters. You can specify a source directive to clone it.
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"github.com/infra-rdc/rudder-go/models/components"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var request *components.DirectiveNew = &components.DirectiveNew{
Source: rudder.String("b9f6d98a-28bc-4d80-90f7-d2f14269e215"),
ID: rudder.String("91252ea2-feb2-412d-8599-c6945fee02c4"),
DisplayName: rudder.String("91252ea2-feb2-412d-8599-c6945fee02c4"),
ShortDescription: rudder.String("91252ea2-feb2-412d-8599-c6945fee02c4"),
LongDescription: rudder.String("# Documentation
* [Ticket link](https://tickets.example.com/issues/3456)"),
TechniqueName: rudder.String("userManagement"),
TechniqueVersion: rudder.String("8.0"),
Priority: rudder.Int64(5),
Enabled: rudder.Bool(true),
System: rudder.Bool(false),
Tags: []components.DirectiveNewTags{
components.DirectiveNewTags{
Name: rudder.String("value"),
},
},
Parameters: &components.DirectiveNewParameters{},
}
ctx := context.Background()
res, err := s.Directives.CreateDirective(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 |
components.DirectiveNew | ✔️ | The request object to use for the request. |
*operations.CreateDirectiveResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Get all information about a given directive
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var directiveID string = "9a1773c9-0889-40b6-be89-f6504443ac1b"
ctx := context.Background()
res, err := s.Directives.DirectiveDetails(ctx, directiveID)
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. | |
directiveID |
string | ✔️ | Id of the directive | 9a1773c9-0889-40b6-be89-f6504443ac1b |
*operations.DirectiveDetailsResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Delete a directive
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var directiveID string = "9a1773c9-0889-40b6-be89-f6504443ac1b"
ctx := context.Background()
res, err := s.Directives.DeleteDirective(ctx, directiveID)
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. | |
directiveID |
string | ✔️ | Id of the directive | 9a1773c9-0889-40b6-be89-f6504443ac1b |
*operations.DeleteDirectiveResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |