@@ -13,33 +13,38 @@ const (
1313
1414type PostureZoneInterface interface {
1515 Base
16- CreateOrUpdatePostureZone (ctx context.Context , z * PostureZoneRequest ) (* PostureZone , error )
16+ CreateOrUpdatePostureZone (ctx context.Context , z * PostureZoneRequest ) (* PostureZone , string , error )
1717 GetPostureZone (ctx context.Context , id int ) (* PostureZone , error )
1818 DeletePostureZone (ctx context.Context , id int ) error
1919}
2020
21- func (client * Client ) CreateOrUpdatePostureZone (ctx context.Context , r * PostureZoneRequest ) (* PostureZone , error ) {
21+ func (client * Client ) CreateOrUpdatePostureZone (ctx context.Context , r * PostureZoneRequest ) (* PostureZone , string , error ) {
2222 if r .ID == "" {
2323 r .ID = "0"
2424 }
2525
2626 payload , err := Marshal (r )
2727 if err != nil {
28- return nil , err
28+ return nil , "" , err
2929 }
3030
3131 response , err := client .requester .Request (ctx , http .MethodPost , client .createZoneURL (), payload )
3232 if err != nil {
33- return nil , err
33+ return nil , "" , err
3434 }
3535 defer response .Body .Close ()
3636
37+ if response .StatusCode != http .StatusOK && response .StatusCode != http .StatusCreated && response .StatusCode != http .StatusAccepted {
38+ errStatus , err := client .ErrorAndStatusFromResponse (response )
39+ return nil , errStatus , err
40+ }
41+
3742 wrapper , err := Unmarshal [PostureZoneResponse ](response .Body )
3843 if err != nil {
39- return nil , err
44+ return nil , "" , err
4045 }
4146
42- return & wrapper .Data , nil
47+ return & wrapper .Data , "" , nil
4348}
4449
4550func (client * Client ) GetPostureZone (ctx context.Context , id int ) (* PostureZone , error ) {
0 commit comments