github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/apps/CreateApp.go (about)

     1  package apps
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type CreateAppOpts struct {
     9  	// Unique identifier of the consumer application to be created.
    10  	// The application name contains 1 to 200 characters, including letters, digits, underscores (_), and hyphens (-).
    11  	// Minimum: 1
    12  	// Maximum: 200
    13  	AppName string `json:"app_name"`
    14  }
    15  
    16  func CreateApp(client *golangsdk.ServiceClient, opts CreateAppOpts) error {
    17  	b, err := build.RequestBody(opts, "")
    18  	if err != nil {
    19  		return err
    20  	}
    21  
    22  	// POST /v2/{project_id}/apps
    23  	_, err = client.Post(client.ServiceURL("apps"), b, nil, &golangsdk.RequestOpts{
    24  		OkCodes: []int{201},
    25  	})
    26  	return err
    27  }