Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Inventory ansibleInventory = make(ansibleInventory, 10)
Functions ¶
func GetExampleAnsibleInventory ¶
func GetExampleAnsibleInventory() ([]byte, ansibleInventory)
func GetJumpserverInventory ¶
func GetUserInfo ¶
Types ¶
type Assets ¶
type Assets struct { Id string `json:"id"` Hostname string `json:"hostname"` Ip string `json:"ip"` Protocols []string `json:"protocols"` Os string `json:"os"` Domain string `json:"domain"` Platform string `json:"platform"` Comment string `json:"comment"` Org_id string `json:"org_id"` Is_active bool `json:"is_active"` Org_name string `json:"org_name"` }
func GetAssetsNodeAssets ¶
func GetAssetsNodePID(jms_url string, auth *SigAuth, nodename string) string { var pid string node := GetAssetsNode(jms_url, auth, nodename) url := jms_url + "/api/v1/perms/users/nodes/tree/" gmt_fmt := "Mon, 02 Jan 2006 15:04:05 GMT" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) req.Header.Add("Date", time.Now().Format(gmt_fmt)) req.Header.Add("Accept", "application/json") // req.Header.Add("X-JMS-ORG", "00000000-0000-0000-0000-000000000002") if err != nil { log.Fatal(err) } if err := auth.Sign(req); err != nil { log.Fatal(err) } resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatal(err) } var nodetree []NodeTree err = json.Unmarshal(body, &nodetree) if err != nil { log.Fatalln("error:", err) } // fmt.Println(nodetree) for _, c := range nodetree { if c.Id == node.Key { pid = c.Id } } return pid }
Click to show internal directories.
Click to hide internal directories.