github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/lbaas_v2/monitors/doc.go (about) 1 /* 2 Package monitors provides information and interaction with Monitors 3 of the LBaaS v2 extension for the OpenStack Networking service. 4 5 Example to List Monitors 6 7 listOpts := monitors.ListOpts{ 8 PoolID: "c79a4468-d788-410c-bf79-9a8ef6354852", 9 } 10 11 allPages, err := monitors.List(networkClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allMonitors, err := monitors.ExtractMonitors(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, monitor := range allMonitors { 22 fmt.Printf("%+v\n", monitor) 23 } 24 25 Example to Create a Monitor 26 27 createOpts := monitors.CreateOpts{ 28 Type: "HTTP", 29 Name: "db", 30 PoolID: "84f1b61f-58c4-45bf-a8a9-2dafb9e5214d", 31 Delay: 20, 32 Timeout: 10, 33 MaxRetries: 5, 34 URLPath: "/check", 35 ExpectedCodes: "200-299", 36 } 37 38 monitor, err := monitors.Create(networkClient, createOpts).Extract() 39 if err != nil { 40 panic(err) 41 } 42 43 Example to Update a Monitor 44 45 monitorID := "d67d56a6-4a86-4688-a282-f46444705c64" 46 47 updateOpts := monitors.UpdateOpts{ 48 Name: "NewHealthmonitorName", 49 Delay: 3, 50 Timeout: 20, 51 MaxRetries: 10, 52 URLPath: "/another_check", 53 ExpectedCodes: "301", 54 } 55 56 monitor, err := monitors.Update(networkClient, monitorID, updateOpts).Extract() 57 if err != nil { 58 panic(err) 59 } 60 61 Example to Delete a Monitor 62 63 monitorID := "d67d56a6-4a86-4688-a282-f46444705c64" 64 err := monitors.Delete(networkClient, monitorID).ExtractErr() 65 if err != nil { 66 panic(err) 67 } 68 */ 69 package monitors