Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

TT-99 Policies update #30

Merged
merged 2 commits into from
Jun 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions clients/objects/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,31 @@ type AccessDefinition struct {
}

type Policy struct {
MID bson.ObjectId `bson:"_id,omitempty" json:"_id"`
ID string `bson:"id,omitempty" json:"id"`
OrgID string `bson:"org_id" json:"org_id"`
Rate float64 `bson:"rate" json:"rate"`
Per float64 `bson:"per" json:"per"`
QuotaMax int64 `bson:"quota_max" json:"quota_max"`
QuotaRenewalRate int64 `bson:"quota_renewal_rate" json:"quota_renewal_rate"`
AccessRights map[string]AccessDefinition `bson:"access_rights" json:"access_rights"`
HMACEnabled bool `bson:"hmac_enabled" json:"hmac_enabled"`
Active bool `bson:"active" json:"active"`
Name string `bson:"name" json:"name"`
IsInactive bool `bson:"is_inactive" json:"is_inactive"`
DateCreated time.Time `bson:"date_created" json:"date_created"`
Tags []string `bson:"tags" json:"tags"`
KeyExpiresIn int64 `bson:"key_expires_in" json:"key_expires_in"`
Partitions struct {
MID bson.ObjectId `bson:"_id,omitempty" json:"_id"`
ID string `bson:"id,omitempty" json:"id"`
OrgID string `bson:"org_id" json:"org_id"`
Rate float64 `bson:"rate" json:"rate"`
Per float64 `bson:"per" json:"per"`
ThrottleInterval float64 `bson:"throttle_interval" json:"throttle_interval"`
ThrottleRetryLimit int `bson:"throttle_retry_limit" json:"throttle_retry_limit"`
QuotaMax int64 `bson:"quota_max" json:"quota_max"`
QuotaRenewalRate int64 `bson:"quota_renewal_rate" json:"quota_renewal_rate"`
AccessRights map[string]AccessDefinition `bson:"access_rights" json:"access_rights"`
HMACEnabled bool `bson:"hmac_enabled" json:"hmac_enabled"`
Active bool `bson:"active" json:"active"`
Name string `bson:"name" json:"name"`
IsInactive bool `bson:"is_inactive" json:"is_inactive"`
DateCreated time.Time `bson:"date_created" json:"date_created"`
Tags []string `bson:"tags" json:"tags"`
KeyExpiresIn int64 `bson:"key_expires_in" json:"key_expires_in"`
Partitions struct {
Quota bool `bson:"quota" json:"quota"`
RateLimit bool `bson:"rate_limit" json:"rate_limit"`
Acl bool `bson:"acl" json:"acl"`
PerAPI bool `bson:"per_api" json:"per_api"`
} `bson:"partitions" json:"partitions"`
LastUpdated string `bson:"last_updated" json:"last_updated"`
LastUpdated string `bson:"last_updated" json:"last_updated"`
MetaData map[string]interface{} `bson:"meta_data" json:"meta_data"`
}

func (pol *Policy) FixPolicyAPIIDs(APIIDRelations map[string]string) {
Expand Down