Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed method to search #97

Merged
merged 4 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions cmd/cone/task_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package main
import "github.com/spf13/cobra"

const (
accessReviewIdsFlag = "access-review-id"
appEntitlementIdsFlag = "app-entitlement-id"
appResourceIdsFlag = "app-resource-id"
appResourceTypeIdsFlag = "app-resource-type-id"
appUserSubjectIdsFlag = "app-user-subject-id"
userSubjectIdsFlag = "user-subject-id"
appIdsFlag = "app-id"
assigneeIdsFlag = "assignee-id"
accessReviewIDsFlag = "access-review-id"
appEntitlementIDsFlag = "app-entitlement-id"
appResourceIDsFlag = "app-resource-id"
appResourceTypeIDsFlag = "app-resource-type-id"
appUserSubjectIDsFlag = "app-user-subject-id"
userSubjectIDsFlag = "user-subject-id"
appIDsFlag = "app-id"
assigneeIDsFlag = "assignee-id"
stateFlag = "state"
taskTypeFlag = "task-type"
includeDeletedFlag = "include-deleted"
Expand All @@ -20,29 +20,29 @@ const (
func addCommentFlag(cmd *cobra.Command) {
cmd.Flags().String(commentFlag, "", "Comment to add to the task when performing an action")
}
func addAccessReviewIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(accessReviewIdsFlag, nil, "Filter tasks by access review id(s) (access review campaign this task belongs to)")
func addAccessReviewIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(accessReviewIDsFlag, nil, "Filter tasks by access review id(s) (access review campaign this task belongs to)")
}
func addAppEntitlementIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appEntitlementIdsFlag, nil, "Filter tasks by app entitlement id(s) (target app entitlement of the ticket)")
func addAppEntitlementIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appEntitlementIDsFlag, nil, "Filter tasks by app entitlement id(s) (target app entitlement of the ticket)")
}
func addAppResourceIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appResourceIdsFlag, nil, "Filter tasks by app resource id(s) (target resource of the ticket)")
func addAppResourceIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appResourceIDsFlag, nil, "Filter tasks by app resource id(s) (target resource of the ticket)")
}
func addAppResourceTypeIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appResourceTypeIdsFlag, nil, "Filter tasks by app resource type id(s) (target resource type of the task)")
func addAppResourceTypeIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appResourceTypeIDsFlag, nil, "Filter tasks by app resource type id(s) (target resource type of the task)")
}
func addAppUserSubjectIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appUserSubjectIdsFlag, nil, "Filter tasks by app user subject id(s) (target of the task)")
func addAppUserSubjectIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appUserSubjectIDsFlag, nil, "Filter tasks by app user subject id(s) (target of the task)")
}
func addUserSubjectIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(userSubjectIdsFlag, nil, "Filter tasks by user subject id(s) (c1 user target of the task)")
func addUserSubjectIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(userSubjectIDsFlag, nil, "Filter tasks by user subject id(s) (c1 user target of the task)")
}
func addAppApplicationIdsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appIdsFlag, nil, "Filter tasks by app application id(s) (target application of the task)")
func addAppApplicationIDsFlag(cmd *cobra.Command) {
cmd.Flags().StringSlice(appIDsFlag, nil, "Filter tasks by app application id(s) (target application of the task)")
}
func addAssigneesIds(cmd *cobra.Command) {
cmd.Flags().StringSlice(assigneeIdsFlag, nil, "Filter tasks by who is currently assigned to them")
func addAssigneesIDs(cmd *cobra.Command) {
cmd.Flags().StringSlice(assigneeIDsFlag, nil, "Filter tasks by who is currently assigned to them")
}

func addQueryTaskFlag(cmd *cobra.Command) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/client/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package client
import (
"context"

"github.com/conductorone/conductorone-sdk-go/pkg/models/operations"
"github.com/conductorone/conductorone-sdk-go/pkg/models/shared"
)

Expand All @@ -12,9 +11,9 @@ func (c *client) ListPolicies(ctx context.Context) ([]shared.Policy, error) {
pageSize := float64(100)
pageToken := ""
for {
resp, err := c.sdk.Policies.List(ctx, operations.C1APIPolicyV1PoliciesListRequest{
PageToken: &pageToken,
resp, err := c.sdk.PolicySearch.Search(ctx, &shared.SearchPoliciesRequest{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad our type system and API responses are so regular. Even though this changed from a C1APIPolicyV1PoliciesListResponse to a C1APIPolicyV1PolicySearchSearchResponse, it has the same resp.ListPolicyResponse.List.

PageSize: &pageSize,
PageToken: &pageToken,
})
if err != nil {
return nil, err
Expand Down
Loading