11package cloudgov
22
3- // Stuff we'll need to implement, for ref
4- //
5- // mapRoute()
6- //
7- // addNetworkPolicy()
8- // removeNetworkPolicy()
3+ import "context"
4+
95type ClientAPI interface {
106 connect (url string , creds * Creds ) error
117
@@ -15,6 +11,8 @@ type ClientAPI interface {
1511 appsList () (apps []* App , err error )
1612
1713 sshCode () (string , error )
14+ mapRoute (ctx context.Context , app * App , domain string , space string , host string , path string , port int ) error
15+ addNetworkPolicy (app * App , dest string , space string , port string ) error
1816}
1917
2018type CredsGetter interface {
@@ -42,7 +40,10 @@ func (e CloudGovClientError) Error() string {
4240}
4341
4442// TODO: we should pull this out of VCAP_APPLICATION
45- const apiRootURLDefault = "https://api.fr-stage.cloud.gov"
43+ const (
44+ apiRootURLDefault = "https://api.fr-stage.cloud.gov"
45+ internalDomainGUID = "8a5d6a8c-cfc1-4fc4-afc9-aa563ff9df5e"
46+ )
4647
4748func New (i ClientAPI , o * Opts ) (* Client , error ) {
4849 if o == nil {
@@ -78,9 +79,10 @@ func (c *Client) Connect() (*Client, error) {
7879}
7980
8081type App struct {
81- Name string
82- GUID string
83- State string
82+ Name string
83+ GUID string
84+ State string
85+ SpaceGUID string
8486}
8587
8688func (c * Client ) AppGet (id string ) (* App , error ) {
@@ -133,3 +135,7 @@ func (c *Client) ServicesPush(manifests []*AppManifest) ([]*App, error) {
133135func (c * Client ) SSHCode () (string , error ) {
134136 return c .sshCode ()
135137}
138+
139+ func (c * Client ) MapServiceRoute (app * App ) error {
140+ return c .mapRoute (context .Background (), app , internalDomainGUID , app .SpaceGUID , app .Name , "" , 0 )
141+ }
0 commit comments