status property is not a string

This commit is contained in:
Peter Morton 2023-09-07 15:09:00 -05:00
parent e2f6da1b5f
commit 77f520aa31
2 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,6 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"strings"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"golang.org/x/oauth2" "golang.org/x/oauth2"
@ -121,8 +120,9 @@ func UpdateProperty(c *Config, p []properties.PropertyUpdateOrCreate) error {
log.Fatal(err) log.Fatal(err)
return err return err
} }
if strings.HasPrefix("2", res.Status) {
log.Error(rp[0].Status + rp[0].Description) if rp[0].Status >= 400 {
log.Error(fmt.Sprint(rp[0].Status) + ":" + rp[0].Description)
} }
return nil return nil
@ -162,7 +162,7 @@ func DeleteProperty(c *Config, p []properties.PropertyDelete) error {
return err return err
} }
log.Debug(string(response)) log.Debug("client.DeleteProperty: response is " + string(response))
rp := []properties.PropertyDelete{} rp := []properties.PropertyDelete{}
@ -172,8 +172,8 @@ func DeleteProperty(c *Config, p []properties.PropertyDelete) error {
return err return err
} }
if strings.HasPrefix("2", res.Status) { if rp[0].Status >= 400 {
log.Error(rp[0].Status + rp[0].Description) log.Error(fmt.Sprint(rp[0].Status) + ":" + rp[0].Description)
} }
return nil return nil

View File

@ -5,7 +5,7 @@ type Property struct {
Name string `json:"vcfg:name"` Name string `json:"vcfg:name"`
Value string `json:"vcfg:value"` Value string `json:"vcfg:value"`
ID string `json:"vcfg:id,omitempty"` ID string `json:"vcfg:id,omitempty"`
Status string `json:"vcfg:status,omitempty"` Status int `json:"vcfg:status,omitempty"`
Prefix string `json:"vcfg:prefix,omitempty"` Prefix string `json:"vcfg:prefix,omitempty"`
LastModifiedBy string `json:"vcfg:lastModifiedBy,omitempty"` LastModifiedBy string `json:"vcfg:lastModifiedBy,omitempty"`
LastModifiedDate string `json:"vcfg:lastModifiedDate,omitempty"` LastModifiedDate string `json:"vcfg:lastModifiedDate,omitempty"`
@ -20,13 +20,13 @@ type PropertyUpdateOrCreate struct {
Type string `json:"@type"` Type string `json:"@type"`
Name string `json:"vcfg:name"` Name string `json:"vcfg:name"`
Value string `json:"vcfg:value"` Value string `json:"vcfg:value"`
Status string `json:"vcfg:status"` Status int `json:"vcfg:status"`
Description string `json:"vcfg:description"` Description string `json:"vcfg:description"`
} }
type PropertyDelete struct { type PropertyDelete struct {
Type string `json:"@type"` Type string `json:"@type"`
Name string `json:"vcfg:name"` Name string `json:"vcfg:name"`
Status string `json:"vcfg:status"` Status int `json:"vcfg:status"`
Description string `json:"vcfg:description"` Description string `json:"vcfg:description"`
} }