Skip to content

Commit

Permalink
GCLOUD2-16462 resource list method
Browse files Browse the repository at this point in the history
  • Loading branch information
alexk53 committed Nov 1, 2024
1 parent 34b8e6d commit 5ecc53d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ func (s *Service) Create(ctx context.Context, req *CreateRequest) (*Resource, er
return &resource, nil
}

func (s *Service) List(ctx context.Context) ([]Resource, error) {
var resources []Resource
if err := s.r.Request(ctx, http.MethodGet, "/cdn/resources", nil, &resources); err != nil {
return nil, fmt.Errorf("request: %w", err)
}

return resources, nil
}

func (s *Service) Get(ctx context.Context, id int64) (*Resource, error) {
var resource Resource
if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/cdn/resources/%d", id), nil, &resource); err != nil {
Expand Down

0 comments on commit 5ecc53d

Please sign in to comment.