github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/networking/v1/routetables/Update.go (about)

     1  package routetables
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  // UpdateOpts contains the values used when updating a route table
     9  type UpdateOpts struct {
    10  	Name        string                 `json:"name,omitempty"`
    11  	Description *string                `json:"description,omitempty"`
    12  	Routes      map[string][]RouteOpts `json:"routes,omitempty"`
    13  }
    14  
    15  func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) error {
    16  	body, err := build.RequestBody(opts, "routetable")
    17  	if err != nil {
    18  		return err
    19  	}
    20  	_, err = client.Put(client.ServiceURL(client.ProjectID, "routetables", id), body, nil, &golangsdk.RequestOpts{
    21  		OkCodes: []int{200},
    22  	})
    23  	return err
    24  }