-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from manifoldco/no-teams-yet
Hide team-owned resources from the CLI until proper support is added
- Loading branch information
Showing
10 changed files
with
80 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package clients | ||
|
||
import ( | ||
"context" | ||
|
||
mClient "github.com/manifoldco/manifold-cli/generated/marketplace/client" | ||
"github.com/manifoldco/manifold-cli/generated/marketplace/client/resource" | ||
mModels "github.com/manifoldco/manifold-cli/generated/marketplace/models" | ||
pClient "github.com/manifoldco/manifold-cli/generated/provisioning/client" | ||
"github.com/manifoldco/manifold-cli/generated/provisioning/client/operation" | ||
pModels "github.com/manifoldco/manifold-cli/generated/provisioning/models" | ||
) | ||
|
||
// FetchOperations returns the resources for the authenticated user | ||
func FetchOperations(ctx context.Context, c *pClient.Provisioning) ([]*pModels.Operation, error) { | ||
res, err := c.Operation.GetOperations( | ||
operation.NewGetOperationsParamsWithContext(ctx), nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var results []*pModels.Operation | ||
for _, o := range res.Payload { | ||
// TODO: remove this once CLI has first-class Teams support | ||
if !o.Body.TeamID().IsEmpty() { | ||
continue | ||
} | ||
results = append(results, o) | ||
} | ||
return results, nil | ||
} | ||
|
||
// FetchResources returns the resources for the authenticated user | ||
func FetchResources(ctx context.Context, c *mClient.Marketplace) ([]*mModels.Resource, error) { | ||
res, err := c.Resource.GetResources( | ||
resource.NewGetResourcesParamsWithContext(ctx), nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var results []*mModels.Resource | ||
for _, r := range res.Payload { | ||
// TODO: remove this once CLI has first-class Teams support | ||
if !r.Body.TeamID.IsEmpty() { | ||
continue | ||
} | ||
results = append(results, r) | ||
} | ||
return results, nil | ||
} |
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
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
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
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
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