Skip to content

Commit

Permalink
Add get application by name function
Browse files Browse the repository at this point in the history
  • Loading branch information
vladhanzha committed Jul 22, 2024
1 parent 7a418e1 commit 46704f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cloudconnexa/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ func (c *ApplicationsService) Get(id string) (*ApplicationResponse, error) {
return &application, nil
}

func (c *ApplicationsService) GetByName(name string) (*ApplicationResponse, error) {
applications, err := c.List()
if err != nil {
return nil, err
}

for _, n := range applications {
if n.Name == name {
return &n, nil
}
}
return nil, nil
}

func (c *ApplicationsService) Create(application *Application) (*ApplicationResponse, error) {
applicationJson, err := json.Marshal(application)
if err != nil {
Expand Down

0 comments on commit 46704f2

Please sign in to comment.