Skip to content

Commit

Permalink
feat: Require and changes for keyhub contract version 62
Browse files Browse the repository at this point in the history
  • Loading branch information
maikelpoot committed May 9, 2023
1 parent b1cd8a9 commit 3f5bd26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.
2 changes: 1 addition & 1 deletion keyhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

const (
/* KeyHub contract version supported by this client, set to 0 for latest */
supportedContractVersion = 57
supportedContractVersion = 62

/* KeyHub json mediatype */
mediatype = "application/vnd.topicus.keyhub+json"
Expand Down
36 changes: 4 additions & 32 deletions model/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ package model

import (
"encoding/json"
"fmt"
"net/url"
"strings"
)

const (
Expand Down Expand Up @@ -255,21 +253,14 @@ func (p GroupAdditionalQueryParams) EncodeValues(key string, v *url.Values) erro
return additionalQueryParamsUrlEncoder(p, key, v)
}

const (
PRGRP_SECURITY_LEVEL_LOW ProvisioningGroupSecurityLevel = "LOW"
PRGRP_SECURITY_LEVEL_MEDIUM ProvisioningGroupSecurityLevel = "MEDIUM"
PRGRP_SECURITY_LEVEL_HIGH ProvisioningGroupSecurityLevel = "HIGH"
)

// Section: Group
func NewProvisioningGroup() *ProvisioningGroup {

pg := ProvisioningGroup{
Linkable: Linkable{
DType: "group.ProvisioningGroup",
},
SecurityLevel: PRGRP_SECURITY_LEVEL_HIGH,
StaticProvisioning: false,
ActivationRequired: true,
}
return &pg
}
Expand All @@ -278,26 +269,7 @@ func NewProvisioningGroup() *ProvisioningGroup {
type ProvisioningGroup struct {
Linkable

GroupOnSystem *GroupOnSystem `json:"groupOnSystem,omitempty"`
Group *Group `json:"group"`
SecurityLevel ProvisioningGroupSecurityLevel `json:"securityLevel"`
StaticProvisioning bool `json:"staticProvisioning"`
GroupOnSystem *GroupOnSystem `json:"groupOnSystem,omitempty"`
Group *Group `json:"group"`
ActivationRequired bool `json:"activationRequired"`
}

func (p *ProvisioningGroup) SetSecurityLevelString(level string) error {

switch strings.ToUpper(level) {
case string(PRGRP_SECURITY_LEVEL_HIGH):
p.SecurityLevel = PRGRP_SECURITY_LEVEL_HIGH
case string(PRGRP_SECURITY_LEVEL_MEDIUM):
p.SecurityLevel = PRGRP_SECURITY_LEVEL_MEDIUM
case string(PRGRP_SECURITY_LEVEL_LOW):
p.SecurityLevel = PRGRP_SECURITY_LEVEL_LOW
default:
return fmt.Errorf("value %s is not a valid level", level)
}
return nil

}

type ProvisioningGroupSecurityLevel string

0 comments on commit 3f5bd26

Please sign in to comment.