Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r3n committed Apr 21, 2024
1 parent 5f46cba commit 6899757
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 14 deletions.
9 changes: 9 additions & 0 deletions sdk/client/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ import (
"github.com/sirupsen/logrus"
)

const (
CONDUCTOR_AUTH_KEY = "CONDUCTOR_AUTH_KEY"
CONDUCTOR_AUTH_SECRET = "CONDUCTOR_AUTH_SECRET"
CONDUCTOR_SERVER_URL = "CONDUCTOR_SERVER_URL"
)

var (
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
Expand All @@ -55,6 +61,9 @@ func NewAPIClient(
nil,
)
}
func NewAPIClientFromEnv() *APIClient {
return nil
}

func NewAPIClientWithTokenExpiration(
authenticationSettings *settings.AuthenticationSettings,
Expand Down
20 changes: 10 additions & 10 deletions sdk/client/api_group_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (a *GroupResourceApiService) AddUserToGroup(ctx context.Context, groupId st
)

// create path and map variables
path := "/api/groups/{groupId}/users/{userId}"
path := "/groups/{groupId}/users/{userId}"
path = strings.Replace(path, "{"+"groupId"+"}", fmt.Sprintf("%v", groupId), -1)
path = strings.Replace(path, "{"+"userId"+"}", fmt.Sprintf("%v", userId), -1)

Expand Down Expand Up @@ -123,7 +123,7 @@ func (a *GroupResourceApiService) AddUsersToGroup(ctx context.Context, body []st
)

// create path and map variables
path := "/api/groups/{groupId}/users"
path := "/groups/{groupId}/users"
path = strings.Replace(path, "{"+"groupId"+"}", fmt.Sprintf("%v", groupId), -1)

headerParams := make(map[string]string)
Expand Down Expand Up @@ -191,7 +191,7 @@ func (a *GroupResourceApiService) DeleteGroup(ctx context.Context, id string) (*
)

// create path and map variables
path := "/api/groups/{id}"
path := "/groups/{id}"
path = strings.Replace(path, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)

headerParams := make(map[string]string)
Expand Down Expand Up @@ -262,7 +262,7 @@ func (a *GroupResourceApiService) GetGrantedPermissions1(ctx context.Context, gr
)

// create path and map variables
path := "/api/groups/{groupId}/permissions"
path := "/groups/{groupId}/permissions"
path = strings.Replace(path, "{"+"groupId"+"}", fmt.Sprintf("%v", groupId), -1)

headerParams := make(map[string]string)
Expand Down Expand Up @@ -347,7 +347,7 @@ func (a *GroupResourceApiService) GetGroup(ctx context.Context, id string) (inte
)

// create path and map variables
path := "/api/groups/{id}"
path := "/groups/{id}"
path = strings.Replace(path, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)

headerParams := make(map[string]string)
Expand Down Expand Up @@ -432,7 +432,7 @@ func (a *GroupResourceApiService) GetUsersInGroup(ctx context.Context, id string
)

// create path and map variables
path := "/api/groups/{id}/users"
path := "/groups/{id}/users"
path = strings.Replace(path, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)

headerParams := make(map[string]string)
Expand Down Expand Up @@ -516,7 +516,7 @@ func (a *GroupResourceApiService) ListGroups(ctx context.Context) ([]rbac.Group,
)

// create path and map variables
path := "/api/groups"
path := "/groups"

headerParams := make(map[string]string)
queryParams := url.Values{}
Expand Down Expand Up @@ -601,7 +601,7 @@ func (a *GroupResourceApiService) RemoveUserFromGroup(ctx context.Context, group
)

// create path and map variables
path := "/api/groups/{groupId}/users/{userId}"
path := "/groups/{groupId}/users/{userId}"
path = strings.Replace(path, "{"+"groupId"+"}", fmt.Sprintf("%v", groupId), -1)
path = strings.Replace(path, "{"+"userId"+"}", fmt.Sprintf("%v", userId), -1)

Expand Down Expand Up @@ -686,7 +686,7 @@ func (a *GroupResourceApiService) RemoveUsersFromGroup(ctx context.Context, body
)

// create path and map variables
path := "/api/groups/{groupId}/users"
path := "/groups/{groupId}/users"
path = strings.Replace(path, "{"+"groupId"+"}", fmt.Sprintf("%v", groupId), -1)

headerParams := make(map[string]string)
Expand Down Expand Up @@ -756,7 +756,7 @@ func (a *GroupResourceApiService) UpsertGroup(ctx context.Context, body rbac.Ups
)

// create path and map variables
path := "/api/groups/{id}"
path := "/groups/{id}"
path = strings.Replace(path, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)

headerParams := make(map[string]string)
Expand Down
4 changes: 4 additions & 0 deletions sdk/client/authorization_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ type AuthorizationClient interface {
GrantPermissions(ctx context.Context, body rbac.AuthorizationRequest) (*http.Response, error)
RemovePermissions(ctx context.Context, body rbac.AuthorizationRequest) (*http.Response, error)
}

func NewAuthorizationClient(client *APIClient) AuthorizationClient {
return &AuthorizationResourceApiService{client}
}
4 changes: 4 additions & 0 deletions sdk/client/event_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ type EventHandlerClient interface {
RemoveEventHandler(ctx context.Context, name string) (*http.Response, error)
UpdateEventHandler(ctx context.Context, body model.EventHandler) (*http.Response, error)
}

func NewEventHandlerClient(client *APIClient) EventHandlerClient {
return &EventResourceApiService{client}
}
4 changes: 4 additions & 0 deletions sdk/client/group_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ type GroupClient interface {
RemoveUsersFromGroup(ctx context.Context, body []string, groupId string) (*http.Response, error)
UpsertGroup(ctx context.Context, body rbac.UpsertGroupRequest, id string) (interface{}, *http.Response, error)
}

func NewGroupClient(client *APIClient) GroupClient {
return &GroupResourceApiService{client}
}
4 changes: 4 additions & 0 deletions sdk/client/human_task_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ type HumanTaskClient interface {
UpdateTaskOutput(ctx context.Context, body map[string]interface{}, taskId string, optionals *HumanTaskApiUpdateTaskOutputOpts) (*http.Response, error)
UpdateTaskOutputByRef(ctx context.Context, body map[string]interface{}, workflowId string, taskRefName string, optionals *HumanTaskApiUpdateTaskOutputByRefOpts) (*http.Response, error)
}

func NewHumanTaskClient(client *APIClient) HumanTaskClient {
return &HumanTaskApiService{client}
}
4 changes: 4 additions & 0 deletions sdk/client/metadata_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ type MetadataClient interface {
GetTagsForWorkflowDef(ctx context.Context, name string) ([]model.MetadataTag, error)
GetTagsForTaskDef(ctx context.Context, tasktype string) ([]model.MetadataTag, error)
}

func NewMetadataClient(apiClient *APIClient) MetadataClient {
return &MetadataResourceApiService{apiClient}
}
54 changes: 54 additions & 0 deletions sdk/client/orkes_clients.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package client

type OrkesClients struct {
apiClient *APIClient
}

func (clients *OrkesClients) GetMetadataClient() MetadataClient {
return NewMetadataClient(clients.apiClient)
}
func (clients *OrkesClients) GetWorkflowClient() WorkflowClient {
return NewWorkflowClient(clients.apiClient)
}
func (clients *OrkesClients) GetTaskClient() TaskClient {
return NewTaskClient(clients.apiClient)
}
func (clients *OrkesClients) GetIntegrationClient() IntegrationClient {
return NewIntegrationClient(clients.apiClient)
}
func (clients *OrkesClients) GetPromptClient() PromptClient {
return NewPromptClient(clients.apiClient)
}
func (clients *OrkesClients) GetEnvironmentClient() EnvironmentClient {
return NewEnvironmentClient(clients.apiClient)
}
func (clients *OrkesClients) GetSchedulerClient() SchedulerClient {
return NewSchedulerClient(clients.apiClient)
}
func (clients *OrkesClients) GetWebhooksConfigClient() WebhooksConfigClient {
return NewWebhooksConfigClient(clients.apiClient)
}
func (clients *OrkesClients) GetHumanTaskClient() HumanTaskClient {
return NewHumanTaskClient(clients.apiClient)
}
func (clients *OrkesClients) GetEventHandlerClient() EventHandlerClient {
return NewEventHandlerClient(clients.apiClient)
}
func (clients *OrkesClients) GetWorkflowBulkClient() WorkflowBulkClient {
return NewWorkflowBulkClient(clients.apiClient)
}
func (clients *OrkesClients) GetAuthorizationClient() AuthorizationClient {
return NewAuthorizationClient(clients.apiClient)
}
func (clients *OrkesClients) GetUserClient() UserClient {
return NewUserClient(clients.apiClient)
}
func (clients *OrkesClients) GetGroupClient() GroupClient {
return NewGroupClient(clients.apiClient)
}
func (clients *OrkesClients) GetApplicationClient() ApplicationClient {
return NewApplicationClient(clients.apiClient)
}
func (clients *OrkesClients) GetSecretsClient() SecretsClient {
return NewSecretsClient(clients.apiClient)
}
4 changes: 4 additions & 0 deletions sdk/client/scheduler_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ type SchedulerClient interface {
SaveSchedule(ctx context.Context, body model.SaveScheduleRequest) (interface{}, *http.Response, error)
SearchV2(ctx context.Context, optionals *SchedulerSearchOpts) (model.SearchResultWorkflowSchedule, *http.Response, error)
}

func NewSchedulerClient(apiClient *APIClient) SchedulerClient {
return &SchedulerResourceApiService{apiClient}
}
4 changes: 4 additions & 0 deletions sdk/client/secrets_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ type SecretsClient interface {
PutTagForSecret(ctx context.Context, body []model.Tag, key string) (*http.Response, error)
SecretExists(ctx context.Context, key string) (interface{}, *http.Response, error)
}

func NewSecretsClient(client *APIClient) SecretsClient {
return &SecretResourceApiService{client}
}
4 changes: 4 additions & 0 deletions sdk/client/task_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ type TaskClient interface {
UpdateTaskByRefNameWithWorkerId(ctx context.Context, body map[string]interface{}, workflowId string, taskRefName string, status string, workerId optional.String) (string, *http.Response, error)
updateTaskByRefName(ctx context.Context, body map[string]interface{}, workflowId string, taskRefName string, status string, workerId optional.String) (string, *http.Response, error)
}

func NewTaskClient(apiClient *APIClient) TaskClient {
return &TaskResourceApiService{apiClient}
}
2 changes: 1 addition & 1 deletion sdk/client/webhook_config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ type WebhooksConfigClient interface {
UpdateWebhook(ctx context.Context, body model.WebhookConfig, id string) (model.WebhookConfig, *http.Response, error)
}

func GetWebhooksConfigService(client *APIClient) WebhooksConfigClient {
func NewWebhooksConfigClient(client *APIClient) WebhooksConfigClient {
return &WebhooksConfigResourceApiService{client}
}
4 changes: 4 additions & 0 deletions sdk/client/workflow_bulk_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ type WorkflowBulkClient interface {
Retry1(ctx context.Context, workflowIds []string) (model.BulkResponse, *http.Response, error)
Terminate(ctx context.Context, workflowIds []string, opts *WorkflowBulkResourceApiTerminateOpts) (model.BulkResponse, *http.Response, error)
}

func NewWorkflowBulkClient(client *APIClient) WorkflowBulkClient {
return &WorkflowBulkResourceApiService{client}
}
10 changes: 7 additions & 3 deletions sdk/client/workflow_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type WorkflowClient interface {
GetWorkflowState(ctx context.Context, workflowId string, includeOutput bool, includeVariables bool) (model.WorkflowState, *http.Response, error)
GetExternalStorageLocation(ctx context.Context, path string, operation string, payloadType string) (model.ExternalStorageLocation, *http.Response, error)
GetRunningWorkflow(ctx context.Context, name string, localVarOptionals *WorkflowResourceApiGetRunningWorkflowOpts) ([]string, *http.Response, error)
GetWorkflows(ctx context.Context, body []string, name string, localVarOptionals *UserResourceApiListUsersOpts) (map[string][]model.Workflow, *http.Response, error)
GetWorkflowsBatch(ctx context.Context, body map[string][]string, localVarOptionals *UserResourceApiListUsersOpts) (map[string][]model.Workflow, *http.Response, error)
GetWorkflowsByCorrelationId(ctx context.Context, name string, correlationId string, localVarOptionals *UserResourceApiListUsersOpts) ([]model.Workflow, *http.Response, error)
GetWorkflows(ctx context.Context, body []string, name string, localVarOptionals *WorkflowResourceApiGetWorkflowsOpts) (map[string][]model.Workflow, *http.Response, error)
GetWorkflowsBatch(ctx context.Context, body map[string][]string, localVarOptionals *WorkflowResourceApiGetWorkflowsOpts) (map[string][]model.Workflow, *http.Response, error)
GetWorkflowsByCorrelationId(ctx context.Context, name string, correlationId string, localVarOptionals *WorkflowResourceApiGetWorkflowsOpts) ([]model.Workflow, *http.Response, error)
PauseWorkflow(ctx context.Context, workflowId string) (*http.Response, error)
Rerun(ctx context.Context, body model.RerunWorkflowRequest, workflowId string) (string, *http.Response, error)
ResetWorkflow(ctx context.Context, workflowId string) (*http.Response, error)
Expand All @@ -31,3 +31,7 @@ type WorkflowClient interface {
StartWorkflowWithRequest(ctx context.Context, body model.StartWorkflowRequest) (string, *http.Response, error)
Terminate(ctx context.Context, workflowId string, localVarOptionals *WorkflowResourceApiTerminateOpts) (*http.Response, error)
}

func NewWorkflowClient(apiClient *APIClient) WorkflowClient {
return &WorkflowResourceApiService{apiClient}
}

0 comments on commit 6899757

Please sign in to comment.