github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/install.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/install.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  // Install status describes state of install for a component or service.
    13  type InstallStatus int
    14  
    15  const (
    16  	InstallStatus_UNKNOWN       InstallStatus = 0
    17  	InstallStatus_ERROR         InstallStatus = 1
    18  	InstallStatus_NOT_INSTALLED InstallStatus = 2
    19  	InstallStatus_INSTALLED     InstallStatus = 4
    20  )
    21  
    22  func (o InstallStatus) DeepCopy() InstallStatus { return o }
    23  
    24  var InstallStatusMap = map[string]InstallStatus{
    25  	"UNKNOWN":       0,
    26  	"ERROR":         1,
    27  	"NOT_INSTALLED": 2,
    28  	"INSTALLED":     4,
    29  }
    30  
    31  var InstallStatusRevMap = map[InstallStatus]string{
    32  	0: "UNKNOWN",
    33  	1: "ERROR",
    34  	2: "NOT_INSTALLED",
    35  	4: "INSTALLED",
    36  }
    37  
    38  type InstallAction int
    39  
    40  const (
    41  	InstallAction_UNKNOWN   InstallAction = 0
    42  	InstallAction_NONE      InstallAction = 1
    43  	InstallAction_UPGRADE   InstallAction = 2
    44  	InstallAction_REINSTALL InstallAction = 3
    45  	InstallAction_INSTALL   InstallAction = 4
    46  )
    47  
    48  func (o InstallAction) DeepCopy() InstallAction { return o }
    49  
    50  var InstallActionMap = map[string]InstallAction{
    51  	"UNKNOWN":   0,
    52  	"NONE":      1,
    53  	"UPGRADE":   2,
    54  	"REINSTALL": 3,
    55  	"INSTALL":   4,
    56  }
    57  
    58  var InstallActionRevMap = map[InstallAction]string{
    59  	0: "UNKNOWN",
    60  	1: "NONE",
    61  	2: "UPGRADE",
    62  	3: "REINSTALL",
    63  	4: "INSTALL",
    64  }
    65  
    66  type ServiceStatus struct {
    67  	Version        string        `codec:"version" json:"version"`
    68  	Label          string        `codec:"label" json:"label"`
    69  	Pid            string        `codec:"pid" json:"pid"`
    70  	LastExitStatus string        `codec:"lastExitStatus" json:"lastExitStatus"`
    71  	BundleVersion  string        `codec:"bundleVersion" json:"bundleVersion"`
    72  	InstallStatus  InstallStatus `codec:"installStatus" json:"installStatus"`
    73  	InstallAction  InstallAction `codec:"installAction" json:"installAction"`
    74  	Status         Status        `codec:"status" json:"status"`
    75  }
    76  
    77  func (o ServiceStatus) DeepCopy() ServiceStatus {
    78  	return ServiceStatus{
    79  		Version:        o.Version,
    80  		Label:          o.Label,
    81  		Pid:            o.Pid,
    82  		LastExitStatus: o.LastExitStatus,
    83  		BundleVersion:  o.BundleVersion,
    84  		InstallStatus:  o.InstallStatus.DeepCopy(),
    85  		InstallAction:  o.InstallAction.DeepCopy(),
    86  		Status:         o.Status.DeepCopy(),
    87  	}
    88  }
    89  
    90  type ServicesStatus struct {
    91  	Service []ServiceStatus `codec:"service" json:"service"`
    92  	Kbfs    []ServiceStatus `codec:"kbfs" json:"kbfs"`
    93  	Updater []ServiceStatus `codec:"updater" json:"updater"`
    94  }
    95  
    96  func (o ServicesStatus) DeepCopy() ServicesStatus {
    97  	return ServicesStatus{
    98  		Service: (func(x []ServiceStatus) []ServiceStatus {
    99  			if x == nil {
   100  				return nil
   101  			}
   102  			ret := make([]ServiceStatus, len(x))
   103  			for i, v := range x {
   104  				vCopy := v.DeepCopy()
   105  				ret[i] = vCopy
   106  			}
   107  			return ret
   108  		})(o.Service),
   109  		Kbfs: (func(x []ServiceStatus) []ServiceStatus {
   110  			if x == nil {
   111  				return nil
   112  			}
   113  			ret := make([]ServiceStatus, len(x))
   114  			for i, v := range x {
   115  				vCopy := v.DeepCopy()
   116  				ret[i] = vCopy
   117  			}
   118  			return ret
   119  		})(o.Kbfs),
   120  		Updater: (func(x []ServiceStatus) []ServiceStatus {
   121  			if x == nil {
   122  				return nil
   123  			}
   124  			ret := make([]ServiceStatus, len(x))
   125  			for i, v := range x {
   126  				vCopy := v.DeepCopy()
   127  				ret[i] = vCopy
   128  			}
   129  			return ret
   130  		})(o.Updater),
   131  	}
   132  }
   133  
   134  type FuseMountInfo struct {
   135  	Path   string `codec:"path" json:"path"`
   136  	Fstype string `codec:"fstype" json:"fstype"`
   137  	Output string `codec:"output" json:"output"`
   138  }
   139  
   140  func (o FuseMountInfo) DeepCopy() FuseMountInfo {
   141  	return FuseMountInfo{
   142  		Path:   o.Path,
   143  		Fstype: o.Fstype,
   144  		Output: o.Output,
   145  	}
   146  }
   147  
   148  type FuseStatus struct {
   149  	Version       string          `codec:"version" json:"version"`
   150  	BundleVersion string          `codec:"bundleVersion" json:"bundleVersion"`
   151  	KextID        string          `codec:"kextID" json:"kextID"`
   152  	Path          string          `codec:"path" json:"path"`
   153  	KextStarted   bool            `codec:"kextStarted" json:"kextStarted"`
   154  	InstallStatus InstallStatus   `codec:"installStatus" json:"installStatus"`
   155  	InstallAction InstallAction   `codec:"installAction" json:"installAction"`
   156  	MountInfos    []FuseMountInfo `codec:"mountInfos" json:"mountInfos"`
   157  	Status        Status          `codec:"status" json:"status"`
   158  }
   159  
   160  func (o FuseStatus) DeepCopy() FuseStatus {
   161  	return FuseStatus{
   162  		Version:       o.Version,
   163  		BundleVersion: o.BundleVersion,
   164  		KextID:        o.KextID,
   165  		Path:          o.Path,
   166  		KextStarted:   o.KextStarted,
   167  		InstallStatus: o.InstallStatus.DeepCopy(),
   168  		InstallAction: o.InstallAction.DeepCopy(),
   169  		MountInfos: (func(x []FuseMountInfo) []FuseMountInfo {
   170  			if x == nil {
   171  				return nil
   172  			}
   173  			ret := make([]FuseMountInfo, len(x))
   174  			for i, v := range x {
   175  				vCopy := v.DeepCopy()
   176  				ret[i] = vCopy
   177  			}
   178  			return ret
   179  		})(o.MountInfos),
   180  		Status: o.Status.DeepCopy(),
   181  	}
   182  }
   183  
   184  type ComponentResult struct {
   185  	Name     string `codec:"name" json:"name"`
   186  	Status   Status `codec:"status" json:"status"`
   187  	ExitCode int    `codec:"exitCode" json:"exitCode"`
   188  }
   189  
   190  func (o ComponentResult) DeepCopy() ComponentResult {
   191  	return ComponentResult{
   192  		Name:     o.Name,
   193  		Status:   o.Status.DeepCopy(),
   194  		ExitCode: o.ExitCode,
   195  	}
   196  }
   197  
   198  type InstallResult struct {
   199  	ComponentResults []ComponentResult `codec:"componentResults" json:"componentResults"`
   200  	Status           Status            `codec:"status" json:"status"`
   201  	Fatal            bool              `codec:"fatal" json:"fatal"`
   202  }
   203  
   204  func (o InstallResult) DeepCopy() InstallResult {
   205  	return InstallResult{
   206  		ComponentResults: (func(x []ComponentResult) []ComponentResult {
   207  			if x == nil {
   208  				return nil
   209  			}
   210  			ret := make([]ComponentResult, len(x))
   211  			for i, v := range x {
   212  				vCopy := v.DeepCopy()
   213  				ret[i] = vCopy
   214  			}
   215  			return ret
   216  		})(o.ComponentResults),
   217  		Status: o.Status.DeepCopy(),
   218  		Fatal:  o.Fatal,
   219  	}
   220  }
   221  
   222  type UninstallResult struct {
   223  	ComponentResults []ComponentResult `codec:"componentResults" json:"componentResults"`
   224  	Status           Status            `codec:"status" json:"status"`
   225  }
   226  
   227  func (o UninstallResult) DeepCopy() UninstallResult {
   228  	return UninstallResult{
   229  		ComponentResults: (func(x []ComponentResult) []ComponentResult {
   230  			if x == nil {
   231  				return nil
   232  			}
   233  			ret := make([]ComponentResult, len(x))
   234  			for i, v := range x {
   235  				vCopy := v.DeepCopy()
   236  				ret[i] = vCopy
   237  			}
   238  			return ret
   239  		})(o.ComponentResults),
   240  		Status: o.Status.DeepCopy(),
   241  	}
   242  }
   243  
   244  type FuseStatusArg struct {
   245  	SessionID     int    `codec:"sessionID" json:"sessionID"`
   246  	BundleVersion string `codec:"bundleVersion" json:"bundleVersion"`
   247  }
   248  
   249  type InstallFuseArg struct {
   250  }
   251  
   252  type InstallKBFSArg struct {
   253  }
   254  
   255  type UninstallKBFSArg struct {
   256  }
   257  
   258  type InstallCommandLinePrivilegedArg struct {
   259  }
   260  
   261  type InstallInterface interface {
   262  	FuseStatus(context.Context, FuseStatusArg) (FuseStatus, error)
   263  	InstallFuse(context.Context) (InstallResult, error)
   264  	InstallKBFS(context.Context) (InstallResult, error)
   265  	UninstallKBFS(context.Context) (UninstallResult, error)
   266  	InstallCommandLinePrivileged(context.Context) (InstallResult, error)
   267  }
   268  
   269  func InstallProtocol(i InstallInterface) rpc.Protocol {
   270  	return rpc.Protocol{
   271  		Name: "keybase.1.install",
   272  		Methods: map[string]rpc.ServeHandlerDescription{
   273  			"fuseStatus": {
   274  				MakeArg: func() interface{} {
   275  					var ret [1]FuseStatusArg
   276  					return &ret
   277  				},
   278  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   279  					typedArgs, ok := args.(*[1]FuseStatusArg)
   280  					if !ok {
   281  						err = rpc.NewTypeError((*[1]FuseStatusArg)(nil), args)
   282  						return
   283  					}
   284  					ret, err = i.FuseStatus(ctx, typedArgs[0])
   285  					return
   286  				},
   287  			},
   288  			"installFuse": {
   289  				MakeArg: func() interface{} {
   290  					var ret [1]InstallFuseArg
   291  					return &ret
   292  				},
   293  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   294  					ret, err = i.InstallFuse(ctx)
   295  					return
   296  				},
   297  			},
   298  			"installKBFS": {
   299  				MakeArg: func() interface{} {
   300  					var ret [1]InstallKBFSArg
   301  					return &ret
   302  				},
   303  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   304  					ret, err = i.InstallKBFS(ctx)
   305  					return
   306  				},
   307  			},
   308  			"uninstallKBFS": {
   309  				MakeArg: func() interface{} {
   310  					var ret [1]UninstallKBFSArg
   311  					return &ret
   312  				},
   313  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   314  					ret, err = i.UninstallKBFS(ctx)
   315  					return
   316  				},
   317  			},
   318  			"installCommandLinePrivileged": {
   319  				MakeArg: func() interface{} {
   320  					var ret [1]InstallCommandLinePrivilegedArg
   321  					return &ret
   322  				},
   323  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   324  					ret, err = i.InstallCommandLinePrivileged(ctx)
   325  					return
   326  				},
   327  			},
   328  		},
   329  	}
   330  }
   331  
   332  type InstallClient struct {
   333  	Cli rpc.GenericClient
   334  }
   335  
   336  func (c InstallClient) FuseStatus(ctx context.Context, __arg FuseStatusArg) (res FuseStatus, err error) {
   337  	err = c.Cli.Call(ctx, "keybase.1.install.fuseStatus", []interface{}{__arg}, &res, 0*time.Millisecond)
   338  	return
   339  }
   340  
   341  func (c InstallClient) InstallFuse(ctx context.Context) (res InstallResult, err error) {
   342  	err = c.Cli.Call(ctx, "keybase.1.install.installFuse", []interface{}{InstallFuseArg{}}, &res, 0*time.Millisecond)
   343  	return
   344  }
   345  
   346  func (c InstallClient) InstallKBFS(ctx context.Context) (res InstallResult, err error) {
   347  	err = c.Cli.Call(ctx, "keybase.1.install.installKBFS", []interface{}{InstallKBFSArg{}}, &res, 0*time.Millisecond)
   348  	return
   349  }
   350  
   351  func (c InstallClient) UninstallKBFS(ctx context.Context) (res UninstallResult, err error) {
   352  	err = c.Cli.Call(ctx, "keybase.1.install.uninstallKBFS", []interface{}{UninstallKBFSArg{}}, &res, 0*time.Millisecond)
   353  	return
   354  }
   355  
   356  func (c InstallClient) InstallCommandLinePrivileged(ctx context.Context) (res InstallResult, err error) {
   357  	err = c.Cli.Call(ctx, "keybase.1.install.installCommandLinePrivileged", []interface{}{InstallCommandLinePrivilegedArg{}}, &res, 0*time.Millisecond)
   358  	return
   359  }