github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/lbaas/monitors/doc.go (about) 1 /* 2 Package monitors provides information and interaction with the Monitors 3 of the Load Balancer as a Service extension for the OpenStack Networking 4 Service. 5 6 Example to List Monitors 7 8 listOpts: monitors.ListOpts{ 9 Type: "HTTP", 10 } 11 12 allPages, err := monitors.List(networkClient, listOpts).AllPages() 13 if err != nil { 14 panic(err) 15 } 16 17 allMonitors, err := monitors.ExtractMonitors(allPages) 18 if err != nil { 19 panic(err) 20 } 21 22 for _, monitor := range allMonitors { 23 fmt.Printf("%+v\n", monitor) 24 } 25 26 Example to Create a Monitor 27 28 createOpts := monitors.CreateOpts{ 29 Type: "HTTP", 30 Delay: 20, 31 Timeout: 20, 32 MaxRetries: 5, 33 URLPath: "/check", 34 ExpectedCodes: "200-299", 35 } 36 37 monitor, err := monitors.Create(networkClient, createOpts).Extract() 38 if err != nil { 39 panic(err) 40 } 41 42 Example to Update a Monitor 43 44 monitorID := "681aed03-aadb-43ae-aead-b9016375650a" 45 46 updateOpts := monitors.UpdateOpts{ 47 Timeout: 30, 48 } 49 50 monitor, err := monitors.Update(networkClient, monitorID, updateOpts).Extract() 51 if err != nil { 52 panic(err) 53 } 54 55 Example to Delete a Member 56 57 monitorID := "681aed03-aadb-43ae-aead-b9016375650a" 58 err := monitors.Delete(networkClient, monitorID).ExtractErr() 59 if err != nil { 60 panic(err) 61 } 62 */ 63 package monitors