Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion fortimanager2/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"net/http"

"github.com/fortinetdev/forti-sdk-go/fortimanager2/auth"
"github.com/romanromanovv/forti-sdk-go/fortimanager2/auth"
)

// Config provides configuration to a FMG client instance
Expand Down
10 changes: 4 additions & 6 deletions fortimanager2/sdkcore/forticlient.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"fmt"
"io/ioutil"
"log"
"os"
"net/http"
"net/url"
"strings"
"os"
"regexp"
"strings"

"github.com/fortinetdev/forti-sdk-go/fortimanager2/auth"
"github.com/fortinetdev/forti-sdk-go/fortimanager2/config"
"github.com/fortinetdev/forti-sdk-go/fortimanager2/request"
"github.com/romanromanovv/forti-sdk-go/fortimanager2/auth"
// "strconv"
)

Expand Down Expand Up @@ -114,7 +114,6 @@ func login(auth *auth.Auth, c *FortiSDKClient) {
v2 = append(v2, paramItem)
data["params"] = v2


locJSON, err := json.Marshal(data)
if err != nil {
log.Fatal(err)
Expand All @@ -137,7 +136,6 @@ func login(auth *auth.Auth, c *FortiSDKClient) {
return
}


var result map[string]interface{}
json.Unmarshal([]byte(string(body)), &result)

Expand Down Expand Up @@ -208,7 +206,7 @@ func (c *FortiSDKClient) GetDeviceVersion() (version string, err error) {
if err != nil {
return "", err
}

if version, ok := result["result"].([]interface{})[0].(map[string]interface{})["data"].(map[string]interface{})["Version"].(string); ok {
regexp, err := regexp.Compile(`v([\d.]+)`)
match := regexp.FindStringSubmatch(version)
Expand Down
69 changes: 67 additions & 2 deletions fortimanager2/sdkcore/sdkfos.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"fmt"
)



// UpdateDvmCmdAddDevice API operation for FortiManager updates the specified CmdAddDevice.
// Returns the index value of the CmdAddDevice and execution result when the request executes successfully.
// Returns error for service API and SDK errors.
Expand Down Expand Up @@ -20120,6 +20118,73 @@ func (c *FortiSDKClient) ReadPackagesFirewallPolicy(mkey string, paradict map[st
return
}


// CreatePackagesFirewallPolicy API operation for FortiManager creates a new FirewallPolicy.
// Returns the index value of the FirewallPolicy and execution result when the request executes successfully.
// Returns error for service API and SDK errors.
// See the packages - firewall policy chapter in the FortiManager Handbook - CLI Reference.
func (c *FortiSDKClient) CreatePackagesFirewallPolicyBlock(params *map[string]interface{}, paradict map[string]string) (output map[string]interface{}, err error) {
path := "/pm/config/[*]/pblock/{pblock}/firewall/policy"
path, err = replaceParaWithValue(path, paradict)
if err != nil {
return nil, fmt.Errorf("%v", err)
}

output, err = createUpdate(c, path, "add", params, false)
return
}

// UpdatePackagesFirewallPolicy API operation for FortiManager updates the specified FirewallPolicy.
// Returns the index value of the FirewallPolicy and execution result when the request executes successfully.
// Returns error for service API and SDK errors.
// See the packages - firewall policy chapter in the FortiManager Handbook - CLI Reference.
func (c *FortiSDKClient) UpdatePackagesFirewallPolicyBlock(params *map[string]interface{}, mkey string, paradict map[string]string) (output map[string]interface{}, err error) {
path := "/pm/config/[*]/pblock/{pblock}/firewall/policy"
path, err = replaceParaWithValue(path, paradict)
if err != nil {
return nil, fmt.Errorf("%v", err)
}

path += "/" + escapeURLString(mkey)

output, err = createUpdate(c, path, "set", params, false)
return
}

// DeletePackagesFirewallPolicy API operation for FortiManager deletes the specified FirewallPolicy.
// Returns error for service API and SDK errors.
// See the packages - firewall policy chapter in the FortiManager Handbook - CLI Reference.
func (c *FortiSDKClient) DeletePackagesFirewallPolicyBlock(mkey string, paradict map[string]string) (err error) {
path := "/pm/config/[*]/pblock/{pblock}/firewall/policy"
path, err = replaceParaWithValue(path, paradict)
if err != nil {
return fmt.Errorf("%v", err)
}

path += "/" + escapeURLString(mkey)

err = delete(c, path, "delete", false)
return
}

// ReadPackagesFirewallPolicy API operation for FortiManager gets the FirewallPolicy
// with the specified index value.
// Returns the requested FirewallPolicy value when the request executes successfully.
// Returns error for service API and SDK errors.
// See the packages - firewall policy chapter in the FortiManager Handbook - CLI Reference.
func (c *FortiSDKClient) ReadPackagesFirewallPolicyBlock(mkey string, paradict map[string]string) (mapTmp map[string]interface{}, err error) {
path := "/pm/config/[*]/pblock/{pblock}/firewall/policy"
path, err = replaceParaWithValue(path, paradict)
if err != nil {
return nil, fmt.Errorf("%v", err)
}

path += "/" + escapeURLString(mkey)

mapTmp, err = read(c, path, "get", false)
return
}

// CreatePackagesFirewallPolicy46 API operation for FortiManager creates a new FirewallPolicy46.
// Returns the index value of the FirewallPolicy46 and execution result when the request executes successfully.
// Returns error for service API and SDK errors.
Expand Down