mirror of
https://github.com/openziti/zrok.git
synced 2026-08-24 10:14:56 -05:00
support '--idle' flag for 'zrok list environments' and 'zrok list shares' (#1107)
This commit is contained in:
@@ -28,6 +28,7 @@ type listEnvironmentsCommand struct {
|
||||
hasShares *bool
|
||||
hasAccesses *bool
|
||||
hasActivity *bool
|
||||
idle *bool
|
||||
|
||||
// numeric filters
|
||||
shareCount string
|
||||
@@ -64,6 +65,7 @@ func newListEnvironmentsCommand() *listEnvironmentsCommand {
|
||||
cmd.Flags().BoolP("has-shares", "s", false, "filter environments with shares")
|
||||
cmd.Flags().BoolP("has-accesses", "a", false, "filter environments with accesses")
|
||||
cmd.Flags().BoolP("has-activity", "A", false, "filter environments with recent activity")
|
||||
cmd.Flags().BoolP("idle", "I", false, "filter environments without recent activity")
|
||||
|
||||
// numeric filters
|
||||
cmd.Flags().StringVar(&command.shareCount, "share-count", "", "filter by share count with operator (e.g., '>0', '>=5', '=3')")
|
||||
@@ -128,6 +130,17 @@ func (cmd *listEnvironmentsCommand) run(_ *cobra.Command, _ []string) {
|
||||
req.HasActivity = &val
|
||||
cmd.hasActivity = &val
|
||||
}
|
||||
if cmd.cmd.Flags().Changed("idle") {
|
||||
val, _ := cmd.cmd.Flags().GetBool("idle")
|
||||
req.Idle = &val
|
||||
cmd.idle = &val
|
||||
}
|
||||
|
||||
// validate that hasActivity and idle are not both set
|
||||
if cmd.hasActivity != nil && *cmd.hasActivity && cmd.idle != nil && *cmd.idle {
|
||||
fmt.Println("error: cannot use both --has-activity and --idle flags")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// numeric filters
|
||||
if cmd.shareCount != "" {
|
||||
|
||||
@@ -29,6 +29,7 @@ type listSharesCommand struct {
|
||||
|
||||
// boolean filters
|
||||
hasActivity *bool
|
||||
idle *bool
|
||||
|
||||
// date range filters
|
||||
createdAfter string
|
||||
@@ -61,6 +62,7 @@ func newListSharesCommand() *listSharesCommand {
|
||||
|
||||
// boolean filters
|
||||
cmd.Flags().BoolP("has-activity", "A", false, "filter shares with recent activity")
|
||||
cmd.Flags().BoolP("idle", "I", false, "filter shares without recent activity")
|
||||
|
||||
// date range filters
|
||||
cmd.Flags().StringVar(&command.createdAfter, "created-after", "", "filter by created date (RFC3339 format)")
|
||||
@@ -115,6 +117,17 @@ func (cmd *listSharesCommand) run(_ *cobra.Command, _ []string) {
|
||||
req.HasActivity = &val
|
||||
cmd.hasActivity = &val
|
||||
}
|
||||
if cmd.cmd.Flags().Changed("idle") {
|
||||
val, _ := cmd.cmd.Flags().GetBool("idle")
|
||||
req.Idle = &val
|
||||
cmd.idle = &val
|
||||
}
|
||||
|
||||
// validate that hasActivity and idle are not both set
|
||||
if cmd.hasActivity != nil && *cmd.hasActivity && cmd.idle != nil && *cmd.idle {
|
||||
fmt.Println("error: cannot use both --has-activity and --idle flags")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// date range filters
|
||||
if cmd.createdAfter != "" {
|
||||
|
||||
@@ -106,9 +106,15 @@ func (h *listEnvironmentsHandler) Handle(params metadata.ListEnvironmentsParams,
|
||||
return metadata.NewListEnvironmentsInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
}
|
||||
|
||||
// check for hasActivity filter
|
||||
// validate that hasActivity and idle are not both set
|
||||
if params.HasActivity != nil && *params.HasActivity && params.Idle != nil && *params.Idle {
|
||||
dl.Errorf("hasActivity and idle cannot both be set for user '%v'", principal.Email)
|
||||
return metadata.NewListEnvironmentsBadRequest().WithPayload("cannot use both hasActivity and idle filters")
|
||||
}
|
||||
|
||||
// check for hasActivity or idle filter
|
||||
var activeEnvIds map[int]bool
|
||||
if params.HasActivity != nil && *params.HasActivity {
|
||||
if (params.HasActivity != nil && *params.HasActivity) || (params.Idle != nil && *params.Idle) {
|
||||
// parse and validate activity duration
|
||||
duration := 24 * time.Hour // default
|
||||
if params.ActivityDuration != nil {
|
||||
@@ -175,13 +181,20 @@ func (h *listEnvironmentsHandler) Handle(params metadata.ListEnvironmentsParams,
|
||||
}
|
||||
}
|
||||
|
||||
// apply hasActivity filter
|
||||
// apply hasActivity/idle filter
|
||||
hasActivity := false
|
||||
if activeEnvIds != nil {
|
||||
hasActivity = activeEnvIds[env.Id]
|
||||
|
||||
// filter by hasActivity (wants active environments)
|
||||
if params.HasActivity != nil && *params.HasActivity && !hasActivity {
|
||||
continue
|
||||
}
|
||||
|
||||
// filter by idle (wants inactive environments)
|
||||
if params.Idle != nil && *params.Idle && hasActivity {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
summary := &rest_model_zrok.EnvironmentSummary{
|
||||
|
||||
@@ -101,9 +101,15 @@ func (h *listSharesHandler) Handle(params metadata.ListSharesParams, principal *
|
||||
return metadata.NewListSharesInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
}
|
||||
|
||||
// check for hasActivity filter
|
||||
// validate that hasActivity and idle are not both set
|
||||
if params.HasActivity != nil && *params.HasActivity && params.Idle != nil && *params.Idle {
|
||||
dl.Errorf("hasActivity and idle cannot both be set for user '%v'", principal.Email)
|
||||
return metadata.NewListSharesBadRequest().WithPayload("cannot use both hasActivity and idle filters")
|
||||
}
|
||||
|
||||
// check for hasActivity or idle filter
|
||||
var activeShareIds map[int]bool
|
||||
if params.HasActivity != nil && *params.HasActivity {
|
||||
if (params.HasActivity != nil && *params.HasActivity) || (params.Idle != nil && *params.Idle) {
|
||||
// parse and validate activity duration
|
||||
duration := 24 * time.Hour // default
|
||||
if params.ActivityDuration != nil {
|
||||
@@ -152,13 +158,20 @@ func (h *listSharesHandler) Handle(params metadata.ListSharesParams, principal *
|
||||
}
|
||||
|
||||
for _, shr := range shares {
|
||||
// apply hasActivity filter
|
||||
// apply hasActivity/idle filter
|
||||
hasActivity := false
|
||||
if activeShareIds != nil {
|
||||
hasActivity = activeShareIds[shr.Id]
|
||||
|
||||
// filter by hasActivity (wants active shares)
|
||||
if params.HasActivity != nil && *params.HasActivity && !hasActivity {
|
||||
continue
|
||||
}
|
||||
|
||||
// filter by idle (wants inactive shares)
|
||||
if params.Idle != nil && *params.Idle && hasActivity {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// get environment z_id
|
||||
|
||||
@@ -122,6 +122,12 @@ type ListEnvironmentsParams struct {
|
||||
*/
|
||||
Host *string
|
||||
|
||||
/* Idle.
|
||||
|
||||
filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
*/
|
||||
Idle *bool
|
||||
|
||||
/* RemoteAgent.
|
||||
|
||||
filter by whether agent is enrolled
|
||||
@@ -309,6 +315,17 @@ func (o *ListEnvironmentsParams) SetHost(host *string) {
|
||||
o.Host = host
|
||||
}
|
||||
|
||||
// WithIdle adds the idle to the list environments params
|
||||
func (o *ListEnvironmentsParams) WithIdle(idle *bool) *ListEnvironmentsParams {
|
||||
o.SetIdle(idle)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetIdle adds the idle to the list environments params
|
||||
func (o *ListEnvironmentsParams) SetIdle(idle *bool) {
|
||||
o.Idle = idle
|
||||
}
|
||||
|
||||
// WithRemoteAgent adds the remoteAgent to the list environments params
|
||||
func (o *ListEnvironmentsParams) WithRemoteAgent(remoteAgent *bool) *ListEnvironmentsParams {
|
||||
o.SetRemoteAgent(remoteAgent)
|
||||
@@ -531,6 +548,23 @@ func (o *ListEnvironmentsParams) WriteToRequest(r runtime.ClientRequest, reg str
|
||||
}
|
||||
}
|
||||
|
||||
if o.Idle != nil {
|
||||
|
||||
// query param idle
|
||||
var qrIdle bool
|
||||
|
||||
if o.Idle != nil {
|
||||
qrIdle = *o.Idle
|
||||
}
|
||||
qIdle := swag.FormatBool(qrIdle)
|
||||
if qIdle != "" {
|
||||
|
||||
if err := r.SetQueryParam("idle", qIdle); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.RemoteAgent != nil {
|
||||
|
||||
// query param remoteAgent
|
||||
|
||||
@@ -98,6 +98,12 @@ type ListSharesParams struct {
|
||||
*/
|
||||
HasActivity *bool
|
||||
|
||||
/* Idle.
|
||||
|
||||
filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
*/
|
||||
Idle *bool
|
||||
|
||||
/* PermissionMode.
|
||||
|
||||
filter by permission mode (open/closed)
|
||||
@@ -253,6 +259,17 @@ func (o *ListSharesParams) SetHasActivity(hasActivity *bool) {
|
||||
o.HasActivity = hasActivity
|
||||
}
|
||||
|
||||
// WithIdle adds the idle to the list shares params
|
||||
func (o *ListSharesParams) WithIdle(idle *bool) *ListSharesParams {
|
||||
o.SetIdle(idle)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetIdle adds the idle to the list shares params
|
||||
func (o *ListSharesParams) SetIdle(idle *bool) {
|
||||
o.Idle = idle
|
||||
}
|
||||
|
||||
// WithPermissionMode adds the permissionMode to the list shares params
|
||||
func (o *ListSharesParams) WithPermissionMode(permissionMode *string) *ListSharesParams {
|
||||
o.SetPermissionMode(permissionMode)
|
||||
@@ -429,6 +446,23 @@ func (o *ListSharesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re
|
||||
}
|
||||
}
|
||||
|
||||
if o.Idle != nil {
|
||||
|
||||
// query param idle
|
||||
var qrIdle bool
|
||||
|
||||
if o.Idle != nil {
|
||||
qrIdle = *o.Idle
|
||||
}
|
||||
qIdle := swag.FormatBool(qrIdle)
|
||||
if qIdle != "" {
|
||||
|
||||
if err := r.SetQueryParam("idle", qIdle); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.PermissionMode != nil {
|
||||
|
||||
// query param permissionMode
|
||||
|
||||
@@ -1305,6 +1305,12 @@ func init() {
|
||||
"name": "hasActivity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter environments WITHOUT recent activity (inverse of hasActivity)",
|
||||
"name": "idle",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by share count with operator (e.g., \"\u003e0\", \"\u003e=5\", \"=0\", \"\u003c10\", \"\u003c=3\")",
|
||||
@@ -3522,6 +3528,12 @@ func init() {
|
||||
"name": "hasActivity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter shares WITHOUT recent activity (inverse of hasActivity)",
|
||||
"name": "idle",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)",
|
||||
@@ -5591,6 +5603,12 @@ func init() {
|
||||
"name": "hasActivity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter environments WITHOUT recent activity (inverse of hasActivity)",
|
||||
"name": "idle",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by share count with operator (e.g., \"\u003e0\", \"\u003e=5\", \"=0\", \"\u003c10\", \"\u003c=3\")",
|
||||
@@ -7695,6 +7713,12 @@ func init() {
|
||||
"name": "hasActivity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter shares WITHOUT recent activity (inverse of hasActivity)",
|
||||
"name": "idle",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)",
|
||||
|
||||
@@ -72,6 +72,10 @@ type ListEnvironmentsParams struct {
|
||||
In: query
|
||||
*/
|
||||
Host *string
|
||||
/*filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
In: query
|
||||
*/
|
||||
Idle *bool
|
||||
/*filter by whether agent is enrolled
|
||||
In: query
|
||||
*/
|
||||
@@ -151,6 +155,11 @@ func (o *ListEnvironmentsParams) BindRequest(r *http.Request, route *middleware.
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qIdle, qhkIdle, _ := qs.GetOK("idle")
|
||||
if err := o.bindIdle(qIdle, qhkIdle, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qRemoteAgent, qhkRemoteAgent, _ := qs.GetOK("remoteAgent")
|
||||
if err := o.bindRemoteAgent(qRemoteAgent, qhkRemoteAgent, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
@@ -371,6 +380,29 @@ func (o *ListEnvironmentsParams) bindHost(rawData []string, hasKey bool, formats
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindIdle binds and validates parameter Idle from query.
|
||||
func (o *ListEnvironmentsParams) bindIdle(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := swag.ConvertBool(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("idle", "query", "bool", raw)
|
||||
}
|
||||
o.Idle = &value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindRemoteAgent binds and validates parameter RemoteAgent from query.
|
||||
func (o *ListEnvironmentsParams) bindRemoteAgent(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
|
||||
@@ -25,6 +25,7 @@ type ListEnvironmentsURL struct {
|
||||
HasActivity *bool
|
||||
HasShares *bool
|
||||
Host *string
|
||||
Idle *bool
|
||||
RemoteAgent *bool
|
||||
ShareCount *string
|
||||
UpdatedAfter *string
|
||||
@@ -144,6 +145,14 @@ func (o *ListEnvironmentsURL) Build() (*url.URL, error) {
|
||||
qs.Set("host", hostQ)
|
||||
}
|
||||
|
||||
var idleQ string
|
||||
if o.Idle != nil {
|
||||
idleQ = swag.FormatBool(*o.Idle)
|
||||
}
|
||||
if idleQ != "" {
|
||||
qs.Set("idle", idleQ)
|
||||
}
|
||||
|
||||
var remoteAgentQ string
|
||||
if o.RemoteAgent != nil {
|
||||
remoteAgentQ = swag.FormatBool(*o.RemoteAgent)
|
||||
|
||||
@@ -56,6 +56,10 @@ type ListSharesParams struct {
|
||||
In: query
|
||||
*/
|
||||
HasActivity *bool
|
||||
/*filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
In: query
|
||||
*/
|
||||
Idle *bool
|
||||
/*filter by permission mode (open/closed)
|
||||
In: query
|
||||
*/
|
||||
@@ -123,6 +127,11 @@ func (o *ListSharesParams) BindRequest(r *http.Request, route *middleware.Matche
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qIdle, qhkIdle, _ := qs.GetOK("idle")
|
||||
if err := o.bindIdle(qIdle, qhkIdle, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qPermissionMode, qhkPermissionMode, _ := qs.GetOK("permissionMode")
|
||||
if err := o.bindPermissionMode(qPermissionMode, qhkPermissionMode, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
@@ -271,6 +280,29 @@ func (o *ListSharesParams) bindHasActivity(rawData []string, hasKey bool, format
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindIdle binds and validates parameter Idle from query.
|
||||
func (o *ListSharesParams) bindIdle(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := swag.ConvertBool(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("idle", "query", "bool", raw)
|
||||
}
|
||||
o.Idle = &value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindPermissionMode binds and validates parameter PermissionMode from query.
|
||||
func (o *ListSharesParams) bindPermissionMode(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
|
||||
@@ -21,6 +21,7 @@ type ListSharesURL struct {
|
||||
CreatedBefore *string
|
||||
EnvZID *string
|
||||
HasActivity *bool
|
||||
Idle *bool
|
||||
PermissionMode *string
|
||||
ShareMode *string
|
||||
ShareToken *string
|
||||
@@ -110,6 +111,14 @@ func (o *ListSharesURL) Build() (*url.URL, error) {
|
||||
qs.Set("hasActivity", hasActivityQ)
|
||||
}
|
||||
|
||||
var idleQ string
|
||||
if o.Idle != nil {
|
||||
idleQ = swag.FormatBool(*o.Idle)
|
||||
}
|
||||
if idleQ != "" {
|
||||
qs.Set("idle", idleQ)
|
||||
}
|
||||
|
||||
var permissionModeQ string
|
||||
if o.PermissionMode != nil {
|
||||
permissionModeQ = *o.PermissionMode
|
||||
|
||||
@@ -120,6 +120,7 @@ export interface ListEnvironmentsRequest {
|
||||
hasShares?: boolean;
|
||||
hasAccesses?: boolean;
|
||||
hasActivity?: boolean;
|
||||
idle?: boolean;
|
||||
shareCount?: string;
|
||||
accessCount?: string;
|
||||
createdAfter?: string;
|
||||
@@ -141,6 +142,7 @@ export interface ListSharesRequest {
|
||||
target?: string;
|
||||
permissionMode?: string;
|
||||
hasActivity?: boolean;
|
||||
idle?: boolean;
|
||||
activityDuration?: string;
|
||||
createdAfter?: string;
|
||||
createdBefore?: string;
|
||||
@@ -613,6 +615,10 @@ export class MetadataApi extends runtime.BaseAPI {
|
||||
queryParameters['hasActivity'] = requestParameters['hasActivity'];
|
||||
}
|
||||
|
||||
if (requestParameters['idle'] != null) {
|
||||
queryParameters['idle'] = requestParameters['idle'];
|
||||
}
|
||||
|
||||
if (requestParameters['shareCount'] != null) {
|
||||
queryParameters['shareCount'] = requestParameters['shareCount'];
|
||||
}
|
||||
@@ -770,6 +776,10 @@ export class MetadataApi extends runtime.BaseAPI {
|
||||
queryParameters['hasActivity'] = requestParameters['hasActivity'];
|
||||
}
|
||||
|
||||
if (requestParameters['idle'] != null) {
|
||||
queryParameters['idle'] = requestParameters['idle'];
|
||||
}
|
||||
|
||||
if (requestParameters['activityDuration'] != null) {
|
||||
queryParameters['activityDuration'] = requestParameters['activityDuration'];
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **list_environments**
|
||||
> EnvironmentsList list_environments(description=description, host=host, address=address, remote_agent=remote_agent, has_shares=has_shares, has_accesses=has_accesses, has_activity=has_activity, share_count=share_count, access_count=access_count, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before, activity_duration=activity_duration)
|
||||
> EnvironmentsList list_environments(description=description, host=host, address=address, remote_agent=remote_agent, has_shares=has_shares, has_accesses=has_accesses, has_activity=has_activity, idle=idle, share_count=share_count, access_count=access_count, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before, activity_duration=activity_duration)
|
||||
|
||||
### Example
|
||||
|
||||
@@ -891,6 +891,7 @@ with zrok_api.ApiClient(configuration) as api_client:
|
||||
has_shares = True # bool | filter by whether environment has active shares (optional)
|
||||
has_accesses = True # bool | filter by whether environment has active accesses (optional)
|
||||
has_activity = True # bool | filter by whether environment has metrics within activityDuration timeframe (optional)
|
||||
idle = True # bool | filter environments WITHOUT recent activity (inverse of hasActivity) (optional)
|
||||
share_count = 'share_count_example' # str | filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\") (optional)
|
||||
access_count = 'access_count_example' # str | filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\") (optional)
|
||||
created_after = 'created_after_example' # str | filter by created date (RFC3339 datetime, inclusive) (optional)
|
||||
@@ -900,7 +901,7 @@ with zrok_api.ApiClient(configuration) as api_client:
|
||||
activity_duration = 'activity_duration_example' # str | duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h) (optional)
|
||||
|
||||
try:
|
||||
api_response = api_instance.list_environments(description=description, host=host, address=address, remote_agent=remote_agent, has_shares=has_shares, has_accesses=has_accesses, has_activity=has_activity, share_count=share_count, access_count=access_count, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before, activity_duration=activity_duration)
|
||||
api_response = api_instance.list_environments(description=description, host=host, address=address, remote_agent=remote_agent, has_shares=has_shares, has_accesses=has_accesses, has_activity=has_activity, idle=idle, share_count=share_count, access_count=access_count, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before, activity_duration=activity_duration)
|
||||
print("The response of MetadataApi->list_environments:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
@@ -921,6 +922,7 @@ Name | Type | Description | Notes
|
||||
**has_shares** | **bool**| filter by whether environment has active shares | [optional]
|
||||
**has_accesses** | **bool**| filter by whether environment has active accesses | [optional]
|
||||
**has_activity** | **bool**| filter by whether environment has metrics within activityDuration timeframe | [optional]
|
||||
**idle** | **bool**| filter environments WITHOUT recent activity (inverse of hasActivity) | [optional]
|
||||
**share_count** | **str**| filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\") | [optional]
|
||||
**access_count** | **str**| filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\") | [optional]
|
||||
**created_after** | **str**| filter by created date (RFC3339 datetime, inclusive) | [optional]
|
||||
@@ -1101,7 +1103,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **list_shares**
|
||||
> SharesList list_shares(env_zid=env_zid, share_mode=share_mode, backend_mode=backend_mode, share_token=share_token, target=target, permission_mode=permission_mode, has_activity=has_activity, activity_duration=activity_duration, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before)
|
||||
> SharesList list_shares(env_zid=env_zid, share_mode=share_mode, backend_mode=backend_mode, share_token=share_token, target=target, permission_mode=permission_mode, has_activity=has_activity, idle=idle, activity_duration=activity_duration, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before)
|
||||
|
||||
### Example
|
||||
|
||||
@@ -1141,6 +1143,7 @@ with zrok_api.ApiClient(configuration) as api_client:
|
||||
target = 'target_example' # str | filter by target (substring match) (optional)
|
||||
permission_mode = 'permission_mode_example' # str | filter by permission mode (open/closed) (optional)
|
||||
has_activity = True # bool | filter shares with recent activity (optional)
|
||||
idle = True # bool | filter shares WITHOUT recent activity (inverse of hasActivity) (optional)
|
||||
activity_duration = 'activity_duration_example' # str | duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h) (optional)
|
||||
created_after = 'created_after_example' # str | filter by created date (RFC3339 format) (optional)
|
||||
created_before = 'created_before_example' # str | filter by created date (RFC3339 format) (optional)
|
||||
@@ -1148,7 +1151,7 @@ with zrok_api.ApiClient(configuration) as api_client:
|
||||
updated_before = 'updated_before_example' # str | filter by updated date (RFC3339 format) (optional)
|
||||
|
||||
try:
|
||||
api_response = api_instance.list_shares(env_zid=env_zid, share_mode=share_mode, backend_mode=backend_mode, share_token=share_token, target=target, permission_mode=permission_mode, has_activity=has_activity, activity_duration=activity_duration, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before)
|
||||
api_response = api_instance.list_shares(env_zid=env_zid, share_mode=share_mode, backend_mode=backend_mode, share_token=share_token, target=target, permission_mode=permission_mode, has_activity=has_activity, idle=idle, activity_duration=activity_duration, created_after=created_after, created_before=created_before, updated_after=updated_after, updated_before=updated_before)
|
||||
print("The response of MetadataApi->list_shares:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
@@ -1169,6 +1172,7 @@ Name | Type | Description | Notes
|
||||
**target** | **str**| filter by target (substring match) | [optional]
|
||||
**permission_mode** | **str**| filter by permission mode (open/closed) | [optional]
|
||||
**has_activity** | **bool**| filter shares with recent activity | [optional]
|
||||
**idle** | **bool**| filter shares WITHOUT recent activity (inverse of hasActivity) | [optional]
|
||||
**activity_duration** | **str**| duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h) | [optional]
|
||||
**created_after** | **str**| filter by created date (RFC3339 format) | [optional]
|
||||
**created_before** | **str**| filter by created date (RFC3339 format) | [optional]
|
||||
|
||||
@@ -3125,6 +3125,7 @@ class MetadataApi:
|
||||
has_shares: Annotated[Optional[StrictBool], Field(description="filter by whether environment has active shares")] = None,
|
||||
has_accesses: Annotated[Optional[StrictBool], Field(description="filter by whether environment has active accesses")] = None,
|
||||
has_activity: Annotated[Optional[StrictBool], Field(description="filter by whether environment has metrics within activityDuration timeframe")] = None,
|
||||
idle: Annotated[Optional[StrictBool], Field(description="filter environments WITHOUT recent activity (inverse of hasActivity)")] = None,
|
||||
share_count: Annotated[Optional[StrictStr], Field(description="filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")")] = None,
|
||||
access_count: Annotated[Optional[StrictStr], Field(description="filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")")] = None,
|
||||
created_after: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 datetime, inclusive)")] = None,
|
||||
@@ -3162,6 +3163,8 @@ class MetadataApi:
|
||||
:type has_accesses: bool
|
||||
:param has_activity: filter by whether environment has metrics within activityDuration timeframe
|
||||
:type has_activity: bool
|
||||
:param idle: filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
:type idle: bool
|
||||
:param share_count: filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")
|
||||
:type share_count: str
|
||||
:param access_count: filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")
|
||||
@@ -3206,6 +3209,7 @@ class MetadataApi:
|
||||
has_shares=has_shares,
|
||||
has_accesses=has_accesses,
|
||||
has_activity=has_activity,
|
||||
idle=idle,
|
||||
share_count=share_count,
|
||||
access_count=access_count,
|
||||
created_after=created_after,
|
||||
@@ -3246,6 +3250,7 @@ class MetadataApi:
|
||||
has_shares: Annotated[Optional[StrictBool], Field(description="filter by whether environment has active shares")] = None,
|
||||
has_accesses: Annotated[Optional[StrictBool], Field(description="filter by whether environment has active accesses")] = None,
|
||||
has_activity: Annotated[Optional[StrictBool], Field(description="filter by whether environment has metrics within activityDuration timeframe")] = None,
|
||||
idle: Annotated[Optional[StrictBool], Field(description="filter environments WITHOUT recent activity (inverse of hasActivity)")] = None,
|
||||
share_count: Annotated[Optional[StrictStr], Field(description="filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")")] = None,
|
||||
access_count: Annotated[Optional[StrictStr], Field(description="filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")")] = None,
|
||||
created_after: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 datetime, inclusive)")] = None,
|
||||
@@ -3283,6 +3288,8 @@ class MetadataApi:
|
||||
:type has_accesses: bool
|
||||
:param has_activity: filter by whether environment has metrics within activityDuration timeframe
|
||||
:type has_activity: bool
|
||||
:param idle: filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
:type idle: bool
|
||||
:param share_count: filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")
|
||||
:type share_count: str
|
||||
:param access_count: filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")
|
||||
@@ -3327,6 +3334,7 @@ class MetadataApi:
|
||||
has_shares=has_shares,
|
||||
has_accesses=has_accesses,
|
||||
has_activity=has_activity,
|
||||
idle=idle,
|
||||
share_count=share_count,
|
||||
access_count=access_count,
|
||||
created_after=created_after,
|
||||
@@ -3367,6 +3375,7 @@ class MetadataApi:
|
||||
has_shares: Annotated[Optional[StrictBool], Field(description="filter by whether environment has active shares")] = None,
|
||||
has_accesses: Annotated[Optional[StrictBool], Field(description="filter by whether environment has active accesses")] = None,
|
||||
has_activity: Annotated[Optional[StrictBool], Field(description="filter by whether environment has metrics within activityDuration timeframe")] = None,
|
||||
idle: Annotated[Optional[StrictBool], Field(description="filter environments WITHOUT recent activity (inverse of hasActivity)")] = None,
|
||||
share_count: Annotated[Optional[StrictStr], Field(description="filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")")] = None,
|
||||
access_count: Annotated[Optional[StrictStr], Field(description="filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")")] = None,
|
||||
created_after: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 datetime, inclusive)")] = None,
|
||||
@@ -3404,6 +3413,8 @@ class MetadataApi:
|
||||
:type has_accesses: bool
|
||||
:param has_activity: filter by whether environment has metrics within activityDuration timeframe
|
||||
:type has_activity: bool
|
||||
:param idle: filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
:type idle: bool
|
||||
:param share_count: filter by share count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")
|
||||
:type share_count: str
|
||||
:param access_count: filter by access count with operator (e.g., \">0\", \">=5\", \"=0\", \"<10\", \"<=3\")
|
||||
@@ -3448,6 +3459,7 @@ class MetadataApi:
|
||||
has_shares=has_shares,
|
||||
has_accesses=has_accesses,
|
||||
has_activity=has_activity,
|
||||
idle=idle,
|
||||
share_count=share_count,
|
||||
access_count=access_count,
|
||||
created_after=created_after,
|
||||
@@ -3483,6 +3495,7 @@ class MetadataApi:
|
||||
has_shares,
|
||||
has_accesses,
|
||||
has_activity,
|
||||
idle,
|
||||
share_count,
|
||||
access_count,
|
||||
created_after,
|
||||
@@ -3540,6 +3553,10 @@ class MetadataApi:
|
||||
|
||||
_query_params.append(('hasActivity', has_activity))
|
||||
|
||||
if idle is not None:
|
||||
|
||||
_query_params.append(('idle', idle))
|
||||
|
||||
if share_count is not None:
|
||||
|
||||
_query_params.append(('shareCount', share_count))
|
||||
@@ -4125,6 +4142,7 @@ class MetadataApi:
|
||||
target: Annotated[Optional[StrictStr], Field(description="filter by target (substring match)")] = None,
|
||||
permission_mode: Annotated[Optional[StrictStr], Field(description="filter by permission mode (open/closed)")] = None,
|
||||
has_activity: Annotated[Optional[StrictBool], Field(description="filter shares with recent activity")] = None,
|
||||
idle: Annotated[Optional[StrictBool], Field(description="filter shares WITHOUT recent activity (inverse of hasActivity)")] = None,
|
||||
activity_duration: Annotated[Optional[StrictStr], Field(description="duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)")] = None,
|
||||
created_after: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 format)")] = None,
|
||||
created_before: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 format)")] = None,
|
||||
@@ -4160,6 +4178,8 @@ class MetadataApi:
|
||||
:type permission_mode: str
|
||||
:param has_activity: filter shares with recent activity
|
||||
:type has_activity: bool
|
||||
:param idle: filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
:type idle: bool
|
||||
:param activity_duration: duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)
|
||||
:type activity_duration: str
|
||||
:param created_after: filter by created date (RFC3339 format)
|
||||
@@ -4200,6 +4220,7 @@ class MetadataApi:
|
||||
target=target,
|
||||
permission_mode=permission_mode,
|
||||
has_activity=has_activity,
|
||||
idle=idle,
|
||||
activity_duration=activity_duration,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
@@ -4238,6 +4259,7 @@ class MetadataApi:
|
||||
target: Annotated[Optional[StrictStr], Field(description="filter by target (substring match)")] = None,
|
||||
permission_mode: Annotated[Optional[StrictStr], Field(description="filter by permission mode (open/closed)")] = None,
|
||||
has_activity: Annotated[Optional[StrictBool], Field(description="filter shares with recent activity")] = None,
|
||||
idle: Annotated[Optional[StrictBool], Field(description="filter shares WITHOUT recent activity (inverse of hasActivity)")] = None,
|
||||
activity_duration: Annotated[Optional[StrictStr], Field(description="duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)")] = None,
|
||||
created_after: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 format)")] = None,
|
||||
created_before: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 format)")] = None,
|
||||
@@ -4273,6 +4295,8 @@ class MetadataApi:
|
||||
:type permission_mode: str
|
||||
:param has_activity: filter shares with recent activity
|
||||
:type has_activity: bool
|
||||
:param idle: filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
:type idle: bool
|
||||
:param activity_duration: duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)
|
||||
:type activity_duration: str
|
||||
:param created_after: filter by created date (RFC3339 format)
|
||||
@@ -4313,6 +4337,7 @@ class MetadataApi:
|
||||
target=target,
|
||||
permission_mode=permission_mode,
|
||||
has_activity=has_activity,
|
||||
idle=idle,
|
||||
activity_duration=activity_duration,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
@@ -4351,6 +4376,7 @@ class MetadataApi:
|
||||
target: Annotated[Optional[StrictStr], Field(description="filter by target (substring match)")] = None,
|
||||
permission_mode: Annotated[Optional[StrictStr], Field(description="filter by permission mode (open/closed)")] = None,
|
||||
has_activity: Annotated[Optional[StrictBool], Field(description="filter shares with recent activity")] = None,
|
||||
idle: Annotated[Optional[StrictBool], Field(description="filter shares WITHOUT recent activity (inverse of hasActivity)")] = None,
|
||||
activity_duration: Annotated[Optional[StrictStr], Field(description="duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)")] = None,
|
||||
created_after: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 format)")] = None,
|
||||
created_before: Annotated[Optional[StrictStr], Field(description="filter by created date (RFC3339 format)")] = None,
|
||||
@@ -4386,6 +4412,8 @@ class MetadataApi:
|
||||
:type permission_mode: str
|
||||
:param has_activity: filter shares with recent activity
|
||||
:type has_activity: bool
|
||||
:param idle: filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
:type idle: bool
|
||||
:param activity_duration: duration for hasActivity filter (e.g., \"24h\", \"7d\", \"30d\"). default \"24h\", maximum \"30d\" (720h)
|
||||
:type activity_duration: str
|
||||
:param created_after: filter by created date (RFC3339 format)
|
||||
@@ -4426,6 +4454,7 @@ class MetadataApi:
|
||||
target=target,
|
||||
permission_mode=permission_mode,
|
||||
has_activity=has_activity,
|
||||
idle=idle,
|
||||
activity_duration=activity_duration,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
@@ -4459,6 +4488,7 @@ class MetadataApi:
|
||||
target,
|
||||
permission_mode,
|
||||
has_activity,
|
||||
idle,
|
||||
activity_duration,
|
||||
created_after,
|
||||
created_before,
|
||||
@@ -4514,6 +4544,10 @@ class MetadataApi:
|
||||
|
||||
_query_params.append(('hasActivity', has_activity))
|
||||
|
||||
if idle is not None:
|
||||
|
||||
_query_params.append(('idle', idle))
|
||||
|
||||
if activity_duration is not None:
|
||||
|
||||
_query_params.append(('activityDuration', activity_duration))
|
||||
|
||||
@@ -104,6 +104,10 @@
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter by whether environment has metrics within activityDuration timeframe
|
||||
- name: idle
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
- name: shareCount
|
||||
in: query
|
||||
type: string
|
||||
@@ -184,6 +188,10 @@
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter shares with recent activity
|
||||
- name: idle
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
- name: activityDuration
|
||||
in: query
|
||||
type: string
|
||||
|
||||
@@ -1553,6 +1553,10 @@ paths:
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter by whether environment has metrics within activityDuration timeframe
|
||||
- name: idle
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter environments WITHOUT recent activity (inverse of hasActivity)
|
||||
- name: shareCount
|
||||
in: query
|
||||
type: string
|
||||
@@ -1633,6 +1637,10 @@ paths:
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter shares with recent activity
|
||||
- name: idle
|
||||
in: query
|
||||
type: boolean
|
||||
description: filter shares WITHOUT recent activity (inverse of hasActivity)
|
||||
- name: activityDuration
|
||||
in: query
|
||||
type: string
|
||||
|
||||
@@ -120,6 +120,7 @@ export interface ListEnvironmentsRequest {
|
||||
hasShares?: boolean;
|
||||
hasAccesses?: boolean;
|
||||
hasActivity?: boolean;
|
||||
idle?: boolean;
|
||||
shareCount?: string;
|
||||
accessCount?: string;
|
||||
createdAfter?: string;
|
||||
@@ -141,6 +142,7 @@ export interface ListSharesRequest {
|
||||
target?: string;
|
||||
permissionMode?: string;
|
||||
hasActivity?: boolean;
|
||||
idle?: boolean;
|
||||
activityDuration?: string;
|
||||
createdAfter?: string;
|
||||
createdBefore?: string;
|
||||
@@ -613,6 +615,10 @@ export class MetadataApi extends runtime.BaseAPI {
|
||||
queryParameters['hasActivity'] = requestParameters['hasActivity'];
|
||||
}
|
||||
|
||||
if (requestParameters['idle'] != null) {
|
||||
queryParameters['idle'] = requestParameters['idle'];
|
||||
}
|
||||
|
||||
if (requestParameters['shareCount'] != null) {
|
||||
queryParameters['shareCount'] = requestParameters['shareCount'];
|
||||
}
|
||||
@@ -770,6 +776,10 @@ export class MetadataApi extends runtime.BaseAPI {
|
||||
queryParameters['hasActivity'] = requestParameters['hasActivity'];
|
||||
}
|
||||
|
||||
if (requestParameters['idle'] != null) {
|
||||
queryParameters['idle'] = requestParameters['idle'];
|
||||
}
|
||||
|
||||
if (requestParameters['activityDuration'] != null) {
|
||||
queryParameters['activityDuration'] = requestParameters['activityDuration'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user