-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌱 Add identity, proxy bindings and enable API tests (#311)
Adding identity and proxy methods to binding package. Enabling Hub API test execution on PRs ```Build Hub / test-api (pull_request)``` (in disconnected mode). Follow-up on #268 Signed-off-by: Marek Aufart <[email protected]>
- Loading branch information
Showing
4 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package binding | ||
|
||
import ( | ||
"github.com/konveyor/tackle2-hub/api" | ||
) | ||
|
||
// | ||
// Identity API. | ||
type Identity struct { | ||
// hub API client. | ||
client *Client | ||
} | ||
|
||
// | ||
// Create a Identity. | ||
func (h *Identity) Create(r *api.Identity) (err error) { | ||
err = h.client.Post(api.IdentitiesRoot, &r) | ||
return | ||
} | ||
|
||
// | ||
// Get a Identity by ID. | ||
func (h *Identity) Get(id uint) (r *api.Identity, err error) { | ||
r = &api.Identity{} | ||
path := Path(api.IdentityRoot).Inject(Params{api.ID: id}) | ||
err = h.client.Get(path, r) | ||
return | ||
} | ||
|
||
// | ||
// List Identities. | ||
func (h *Identity) List() (list []api.Identity, err error) { | ||
list = []api.Identity{} | ||
err = h.client.Get(api.IdentitiesRoot, &list) | ||
return | ||
} | ||
|
||
// | ||
// Update a Identity. | ||
func (h *Identity) Update(r *api.Identity) (err error) { | ||
path := Path(api.IdentityRoot).Inject(Params{api.ID: r.ID}) | ||
err = h.client.Put(path, r) | ||
return | ||
} | ||
|
||
// | ||
// Delete a Identity. | ||
func (h *Identity) Delete(id uint) (err error) { | ||
err = h.client.Delete(Path(api.IdentityRoot).Inject(Params{api.ID: id})) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package binding | ||
|
||
import ( | ||
"github.com/konveyor/tackle2-hub/api" | ||
) | ||
|
||
// | ||
// Proxy API. | ||
type Proxy struct { | ||
// hub API client. | ||
client *Client | ||
} | ||
|
||
// | ||
// Create a Proxy. | ||
func (h *Proxy) Create(r *api.Proxy) (err error) { | ||
err = h.client.Post(api.ProxiesRoot, &r) | ||
return | ||
} | ||
|
||
// | ||
// Get a Proxy by ID. | ||
func (h *Proxy) Get(id uint) (r *api.Proxy, err error) { | ||
r = &api.Proxy{} | ||
path := Path(api.ProxyRoot).Inject(Params{api.ID: id}) | ||
err = h.client.Get(path, r) | ||
return | ||
} | ||
|
||
// | ||
// List Proxies. | ||
func (h *Proxy) List() (list []api.Proxy, err error) { | ||
list = []api.Proxy{} | ||
err = h.client.Get(api.ProxiesRoot, &list) | ||
return | ||
} | ||
|
||
// | ||
// Update a Proxy. | ||
func (h *Proxy) Update(r *api.Proxy) (err error) { | ||
path := Path(api.ProxyRoot).Inject(Params{api.ID: r.ID}) | ||
err = h.client.Put(path, r) | ||
return | ||
} | ||
|
||
// | ||
// Delete a Proxy. | ||
func (h *Proxy) Delete(id uint) (err error) { | ||
err = h.client.Delete(Path(api.ProxyRoot).Inject(Params{api.ID: id})) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters