当前位置: 首页>>代码示例>>Golang>>正文


Golang Options.SetPublicKeyPEM方法代码示例

本文整理汇总了Golang中github.com/equinox-io/equinox.Options.SetPublicKeyPEM方法的典型用法代码示例。如果您正苦于以下问题:Golang Options.SetPublicKeyPEM方法的具体用法?Golang Options.SetPublicKeyPEM怎么用?Golang Options.SetPublicKeyPEM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/equinox-io/equinox.Options的用法示例。


在下文中一共展示了Options.SetPublicKeyPEM方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: equinoxUpdate

func equinoxUpdate() error {
	var opts equinox.Options
	if err := opts.SetPublicKeyPEM(publicKey); err != nil {
		return err
	}

	// check for the update
	resp, err := equinox.Check(appID, opts)
	switch {
	case err == equinox.NotAvailableErr:
		fmt.Println("No update available, already at the latest version!")
		return nil
	case err != nil:
		fmt.Println("Update failed:", err)
		return err
	}

	// fetch the update and apply it
	err = resp.Apply()
	if err != nil {
		return err
	}

	fmt.Printf("Updated to new version: %s!\n", resp.ReleaseVersion)
	return nil
}
开发者ID:SpectoLabs,项目名称:hoverfly,代码行数:26,代码来源:update.go

示例2: checkCLIVersion

func checkCLIVersion() error {
	title := "Convox CLI version"
	startCheck(title)

	client, err := updateClient()
	if err != nil {
		return stdcli.Error(err)
	}

	opts := equinox.Options{
		CurrentVersion: Version,
		Channel:        "stable",
		HTTPClient:     client,
	}
	if err := opts.SetPublicKeyPEM(publicKey); err != nil {
		return stdcli.Error(err)
	}

	// check for update
	_, err = equinox.Check("app_i8m2L26DxKL", opts)
	if err == nil && Version != "dev" {
		diagnose(Diagnosis{
			Kind:        "warning",
			Title:       title,
			Description: "<warning>Your Convox CLI is out of date, run `convox update`</warning>",
		})
	} else {
		diagnose(Diagnosis{
			Title: title,
			Kind:  "success",
		})
	}
	return nil
}
开发者ID:convox,项目名称:rack,代码行数:34,代码来源:doctor.go

示例3: cmdUpdate

func cmdUpdate(c *cli.Context) error {
	client, err := updateClient()
	if err != nil {
		return stdcli.ExitError(err)
	}

	stdcli.Spinner.Prefix = "Updating convox/proxy: "
	stdcli.Spinner.Start()

	if err := updateProxy(); err != nil {
		fmt.Printf("\x08\x08FAILED\n")
	} else {
		fmt.Printf("\x08\x08OK\n")
	}

	stdcli.Spinner.Stop()

	stdcli.Spinner.Prefix = "Updating convox: "
	stdcli.Spinner.Start()

	opts := equinox.Options{
		CurrentVersion: Version,
		Channel:        "stable",
		HTTPClient:     client,
	}
	if err := opts.SetPublicKeyPEM(publicKey); err != nil {
		return stdcli.ExitError(err)
	}

	// check for update
	r, err := equinox.Check("app_i8m2L26DxKL", opts)
	switch {
	case err == equinox.NotAvailableErr:
		fmt.Println("\x08\x08Already up to date")
		return nil
	case err != nil:
		return stdcli.ExitError(err)
	}

	// apply update
	err = r.Apply()
	if err != nil {
		return stdcli.ExitError(err)
	}

	fmt.Printf("\x08\x08OK, %s\n", r.ReleaseVersion)
	stdcli.Spinner.Stop()

	return nil
}
开发者ID:gmelika,项目名称:rack,代码行数:50,代码来源:update.go

示例4: cmdUpdate

func cmdUpdate(c *cli.Context) {
	client, err := updateClient()
	if err != nil {
		stdcli.Error(err)
	}

	stdcli.Spinner.Prefix = "Updating: "
	stdcli.Spinner.Start()

	opts := equinox.Options{
		CurrentVersion: Version,
		Channel:        "stable",
		HTTPClient:     client,
	}
	if err := opts.SetPublicKeyPEM(publicKey); err != nil {
		stdcli.Error(err)
		return
	}

	// check for update
	r, err := equinox.Check("app_i8m2L26DxKL", opts)
	switch {
	case err == equinox.NotAvailableErr:
		fmt.Println("\x08\x08Already up to date")
		return
	case err != nil:
		stdcli.Error(err)
		return
	}

	// apply update
	err = r.Apply()
	if err != nil {
		stdcli.Error(err)
		return
	}

	stdcli.Spinner.Stop()
	fmt.Printf("\x08\x08OK, %s\n", r.ReleaseVersion)
}
开发者ID:cleblanc87,项目名称:rack,代码行数:40,代码来源:update.go

示例5: equinoxUpdate

func equinoxUpdate(channel string, skipConfirm bool) error {
	var opts equinox.Options
	if err := opts.SetPublicKeyPEM(publicKey); err != nil {
		return err
	}
	opts.Channel = channel

	// check for the update
	resp, err := equinox.Check(appID, opts)
	switch {
	case err == equinox.NotAvailableErr:
		fmt.Println("No update available, already at the latest version!")
		return nil
	case err != nil:
		fmt.Println("Update failed:", err)
		return err
	}

	fmt.Println("New version available!")
	fmt.Println("Version:", resp.ReleaseVersion)
	fmt.Println("Name:", resp.ReleaseTitle)
	fmt.Println("Details:", resp.ReleaseDescription)

	if !skipConfirm {
		fmt.Printf("Would you like to update [y/n]? ")
		if !askForConfirmation() {
			return nil
		}
	}
	//fmt.Printf("New version available: %s downloading ... \n", resp.ReleaseVersion)
	// fetch the update and apply it
	err = resp.Apply()
	if err != nil {
		return err
	}

	fmt.Printf("Updated to new version: %s!\n", resp.ReleaseVersion)
	return nil
}
开发者ID:codeskyblue,项目名称:gosuv,代码行数:39,代码来源:gosuv.go


注:本文中的github.com/equinox-io/equinox.Options.SetPublicKeyPEM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。