github.com/gophercloud/gophercloud@v1.11.0/openstack/identity/v3/endpoints/doc.go (about)

     1  /*
     2  Package endpoints provides information and interaction with the service
     3  endpoints API resource in the OpenStack Identity service.
     4  
     5  For more information, see:
     6  http://developer.openstack.org/api-ref-identity-v3.html#endpoints-v3
     7  
     8  Example to List Endpoints
     9  
    10  	serviceID := "e629d6e599d9489fb3ae5d9cc12eaea3"
    11  
    12  	listOpts := endpoints.ListOpts{
    13  		ServiceID: serviceID,
    14  	}
    15  
    16  	allPages, err := endpoints.List(identityClient, listOpts).AllPages()
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  
    21  	allEndpoints, err := endpoints.ExtractEndpoints(allPages)
    22  	if err != nil {
    23  		panic(err)
    24  	}
    25  
    26  	for _, endpoint := range allEndpoints {
    27  		fmt.Printf("%+v\n", endpoint)
    28  	}
    29  
    30  Example to Create an Endpoint
    31  
    32  	serviceID := "e629d6e599d9489fb3ae5d9cc12eaea3"
    33  
    34  	createOpts := endpoints.CreateOpts{
    35  		Availability: gophercloud.AvailabilityPublic,
    36  		Name:         "neutron",
    37  		Region:       "RegionOne",
    38  		URL:          "https://localhost:9696",
    39  		ServiceID:    serviceID,
    40  	}
    41  
    42  	endpoint, err := endpoints.Create(identityClient, createOpts).Extract()
    43  	if err != nil {
    44  		panic(err)
    45  	}
    46  
    47  Example to Update an Endpoint
    48  
    49  	endpointID := "ad59deeec5154d1fa0dcff518596f499"
    50  
    51  	updateOpts := endpoints.UpdateOpts{
    52  		Region: "RegionTwo",
    53  	}
    54  
    55  	endpoint, err := endpoints.Update(identityClient, endpointID, updateOpts).Extract()
    56  	if err != nil {
    57  		panic(err)
    58  	}
    59  
    60  Example to Delete an Endpoint
    61  
    62  	endpointID := "ad59deeec5154d1fa0dcff518596f499"
    63  	err := endpoints.Delete(identityClient, endpointID).ExtractErr()
    64  	if err != nil {
    65  		panic(err)
    66  	}
    67  */
    68  package endpoints