Skip to content

Commit

Permalink
Merge pull request #20 from vladhss/feature/get-application-by-name
Browse files Browse the repository at this point in the history
Add get application by name function
  • Loading branch information
sahaqaa authored Jul 22, 2024
2 parents 7a418e1 + 46704f2 commit c14a6bd
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 c14a6bd

Please sign in to comment.