|
| 1 | +package iis |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + "encoding/json" |
| 6 | + "fmt" |
| 7 | +) |
| 8 | + |
| 9 | +func (r *ApplicationPool) Marshal() ([]byte, error) { |
| 10 | + return json.Marshal(r) |
| 11 | +} |
| 12 | + |
| 13 | +type ApplicationPool struct { |
| 14 | + Name string `json:"name"` |
| 15 | + ID string `json:"id"` |
| 16 | + Status string `json:"status"` |
| 17 | + AutoStart bool `json:"auto_start"` |
| 18 | + PipelineMode string `json:"pipeline_mode"` |
| 19 | + ManagedRuntimeVersion string `json:"managed_runtime_version"` |
| 20 | + Enable32BitWin64 bool `json:"enable_32bit_win64"` |
| 21 | + QueueLength int64 `json:"queue_length"` |
| 22 | + CPU CPU `json:"cpu"` |
| 23 | + ProcessModel ProcessModel `json:"process_model"` |
| 24 | + Identity Identity `json:"identity"` |
| 25 | + Recycling Recycling `json:"recycling"` |
| 26 | + RapidFailProtection RapidFailProtection `json:"rapid_fail_protection"` |
| 27 | + ProcessOrphaning ProcessOrphaning `json:"process_orphaning"` |
| 28 | +} |
| 29 | + |
| 30 | +type CPU struct { |
| 31 | + Limit int64 `json:"limit"` |
| 32 | + //LimitInterval int64 `json:"limit_interval"` |
| 33 | + Action string `json:"action"` |
| 34 | + ProcessorAffinityEnabled bool `json:"processor_affinity_enabled"` |
| 35 | + ProcessorAffinityMask32 string `json:"processor_affinity_mask32"` |
| 36 | + ProcessorAffinityMask64 string `json:"processor_affinity_mask64"` |
| 37 | +} |
| 38 | + |
| 39 | +type Identity struct { |
| 40 | + IdentityType string `json:"identity_type"` |
| 41 | + Username string `json:"username"` |
| 42 | + LoadUserProfile bool `json:"load_user_profile"` |
| 43 | +} |
| 44 | + |
| 45 | +type ProcessModel struct { |
| 46 | + //IdleTimeout int64 `json:"idle_timeout"` |
| 47 | + MaxProcesses int64 `json:"max_processes"` |
| 48 | + PingingEnabled bool `json:"pinging_enabled"` |
| 49 | + //PingInterval int64 `json:"ping_interval"` |
| 50 | + //PingResponseTime int64 `json:"ping_response_time"` |
| 51 | + //ShutdownTimeLimit int64 `json:"shutdown_time_limit"` |
| 52 | + //StartupTimeLimit int64 `json:"startup_time_limit"` |
| 53 | + IdleTimeoutAction string `json:"idle_timeout_action"` |
| 54 | +} |
| 55 | + |
| 56 | +type ProcessOrphaning struct { |
| 57 | + Enabled bool `json:"enabled"` |
| 58 | + OrphanActionExe string `json:"orphan_action_exe"` |
| 59 | + OrphanActionParams string `json:"orphan_action_params"` |
| 60 | +} |
| 61 | + |
| 62 | +type RapidFailProtection struct { |
| 63 | + Enabled bool `json:"enabled"` |
| 64 | + LoadBalancerCapabilities string `json:"load_balancer_capabilities"` |
| 65 | + //Interval int64 `json:"interval"` |
| 66 | + MaxCrashes int64 `json:"max_crashes"` |
| 67 | + AutoShutdownExe string `json:"auto_shutdown_exe"` |
| 68 | + AutoShutdownParams string `json:"auto_shutdown_params"` |
| 69 | +} |
| 70 | + |
| 71 | +type Recycling struct { |
| 72 | + DisableOverlappedRecycle bool `json:"disable_overlapped_recycle"` |
| 73 | + DisableRecycleOnConfigChange bool `json:"disable_recycle_on_config_change"` |
| 74 | + LogEvents LogEvents `json:"log_events"` |
| 75 | + PeriodicRestart PeriodicRestart `json:"periodic_restart"` |
| 76 | +} |
| 77 | + |
| 78 | +type LogEvents struct { |
| 79 | + Time bool `json:"time"` |
| 80 | + Requests bool `json:"requests"` |
| 81 | + Schedule bool `json:"schedule"` |
| 82 | + Memory bool `json:"memory"` |
| 83 | + IsapiUnhealthy bool `json:"isapi_unhealthy"` |
| 84 | + OnDemand bool `json:"on_demand"` |
| 85 | + ConfigChange bool `json:"config_change"` |
| 86 | + PrivateMemory bool `json:"private_memory"` |
| 87 | +} |
| 88 | + |
| 89 | +type PeriodicRestart struct { |
| 90 | + //TimeInterval int64 `json:"time_interval"` |
| 91 | + PrivateMemory int64 `json:"private_memory"` |
| 92 | + RequestLimit int64 `json:"request_limit"` |
| 93 | + VirtualMemory int64 `json:"virtual_memory"` |
| 94 | + Schedule []interface{} `json:"schedule"` |
| 95 | +} |
| 96 | + |
| 97 | +func (client Client) ReadAppPool(ctx context.Context, id string) (*ApplicationPool, error) { |
| 98 | + url := fmt.Sprintf("/api/webserver/application-pools/%s", id) |
| 99 | + var appPool ApplicationPool |
| 100 | + if err := getJson(ctx, client, url, &appPool); err != nil { |
| 101 | + return nil, err |
| 102 | + } |
| 103 | + return &appPool, nil |
| 104 | +} |
| 105 | + |
| 106 | +func (client Client) DeleteAppPool(ctx context.Context, id string) error { |
| 107 | + url := fmt.Sprintf("/api/webserver/application-pools/%s", id) |
| 108 | + return httpDelete(ctx, client, url) |
| 109 | +} |
0 commit comments