github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/hypervisors/doc.go (about)

     1  /*
     2  Package hypervisors returns details about list of hypervisors, shows details for a hypervisor
     3  and shows summary statistics for all hypervisors over all compute nodes in the OpenStack cloud.
     4  
     5  Example of Show Hypervisor Details
     6  
     7  	hypervisorID := 42
     8  	hypervisor, err := hypervisors.Get(computeClient, 42).Extract()
     9  	if err != nil {
    10  		panic(err)
    11  	}
    12  
    13  	fmt.Printf("%+v\n", hypervisor)
    14  
    15  Example of Retrieving Details of All Hypervisors
    16  
    17  	allPages, err := hypervisors.List(computeClient).AllPages()
    18  	if err != nil {
    19  		panic(err)
    20  	}
    21  
    22  	allHypervisors, err := hypervisors.ExtractHypervisors(allPages)
    23  	if err != nil {
    24  		panic(err)
    25  	}
    26  
    27  	for _, hypervisor := range allHypervisors {
    28  		fmt.Printf("%+v\n", hypervisor)
    29  	}
    30  
    31  Example of Show Hypervisor Statistics
    32  
    33  	hypervisorsStatistics, err := hypervisors.GetStatistics(computeClient).Extract()
    34  	if err != nil {
    35  		panic(err)
    36  	}
    37  
    38  	fmt.Printf("%+v\n", hypervisorsStatistics)
    39  
    40  Example of Show Hypervisor Uptime
    41  
    42  	hypervisorID := 42
    43  	hypervisorUptime, err := hypervisors.GetUptime(computeClient, hypervisorID).Extract()
    44  	if err != nil {
    45  		panic(err)
    46  	}
    47  
    48  	fmt.Printf("%+v\n", hypervisorUptime)
    49  
    50  */
    51  package hypervisors