(Rules)
Rules management
- GetRuleCategoryDetails - Get rule category details
- DeleteRuleCategory - Delete group category
- UpdateRuleCategory - Update rule category details
- GetRuleTree - Get rules tree
Get detailed information about a rule category
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var ruleCategoryID string = "e0a311fa-f7b2-4f9e-89a9-db517b9c6b90"
ctx := context.Background()
res, err := s.Rules.GetRuleCategoryDetails(ctx, ruleCategoryID)
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. | |
ruleCategoryID |
string | ✔️ | N/A | e0a311fa-f7b2-4f9e-89a9-db517b9c6b90 |
*operations.GetRuleCategoryDetailsResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Delete a group category. It must have no child groups and no children categories.
package main
import(
rudder "github.com/infra-rdc/rudder-go"
"context"
"log"
)
func main() {
s := rudder.New(
rudder.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var ruleCategoryID string = "e0a311fa-f7b2-4f9e-89a9-db517b9c6b90"
ctx := context.Background()
res, err := s.Rules.DeleteRuleCategory(ctx, ruleCategoryID)
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. | |
ruleCategoryID |
string | ✔️ | N/A | e0a311fa-f7b2-4f9e-89a9-db517b9c6b90 |
*operations.DeleteRuleCategoryResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Update detailed information about a rule category
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 ruleCategoryID string = "e0a311fa-f7b2-4f9e-89a9-db517b9c6b90"
ruleCategoryUpdate := components.RuleCategoryUpdate{
Parent: "b9f6d98a-28bc-4d80-90f7-d2f14269e215",
Name: "Security policies",
Description: rudder.String("Baseline applying CIS guidelines"),
}
ctx := context.Background()
res, err := s.Rules.UpdateRuleCategory(ctx, ruleCategoryID, ruleCategoryUpdate)
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. | |
ruleCategoryID |
string | ✔️ | N/A | e0a311fa-f7b2-4f9e-89a9-db517b9c6b90 |
ruleCategoryUpdate |
components.RuleCategoryUpdate | ✔️ | N/A |
*operations.UpdateRuleCategoryResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Get all available rules and their categories in a tree
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.Rules.GetRuleTree(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.GetRuleTreeResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |