當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Client.UpdateDesiredLRP方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry-incubator/receptor.Client.UpdateDesiredLRP方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.UpdateDesiredLRP方法的具體用法?Golang Client.UpdateDesiredLRP怎麽用?Golang Client.UpdateDesiredLRP使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry-incubator/receptor.Client的用法示例。


在下文中一共展示了Client.UpdateDesiredLRP方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: handleScale

func handleScale(receptorClient receptor.Client) {
	if *processGuid == "" {
		logger.Fatal("missing-processGuid", errors.New("Missing mandatory processGuid parameter for scale action"))
	}

	updatePayload := receptor.DesiredLRPUpdateRequest{
		Instances: numberOfInstances,
	}
	err := receptorClient.UpdateDesiredLRP(*processGuid, updatePayload)
	if err != nil {
		logger.Error("failed-to-scale", err, lager.Data{"process-guid": *processGuid, "update-request": updatePayload})
		return
	}
	fmt.Printf("LRP %s scaled to number of instances %d\n", *processGuid, *numberOfInstances)
}
開發者ID:davidwadden,項目名稱:cf-tcp-router-acceptance-tests,代碼行數:15,代碼來源:main.go

示例2:

			externalPort = 62000 + GinkgoParallelNode()
			sampleReceiverPort1 = 8000 + GinkgoParallelNode()
			serverId1 = fmt.Sprintf("serverId-%d", GinkgoParallelNode())

			lrp := helpers.CreateDesiredLRP(logger,
				uint16(externalPort), uint16(sampleReceiverPort1), serverId1, 1)

			err := receptorClient.CreateDesiredLRP(lrp)
			Expect(err).ShouldNot(HaveOccurred())
			processGuid = lrp.ProcessGuid
		})

		AfterEach(func() {
			err := receptorClient.DeleteDesiredLRP(processGuid)
			Expect(err).ShouldNot(HaveOccurred())
		})

		It("receives TCP traffic on desired external port", func() {
			verifyConnection(externalPort, serverId1)

			By("updating LRP with new external port it receives traffic on new external port")
			externalPort = 63000 + GinkgoParallelNode()
			updatedLrp := helpers.UpdateDesiredLRP(uint16(externalPort),
				uint16(sampleReceiverPort1), 1)
			err := receptorClient.UpdateDesiredLRP(processGuid, updatedLrp)
			Expect(err).ShouldNot(HaveOccurred())
			verifyConnection(externalPort, serverId1)
		})
	})
})
開發者ID:davidwadden,項目名稱:cf-tcp-router-acceptance-tests,代碼行數:30,代碼來源:router_test.go


注:本文中的github.com/cloudfoundry-incubator/receptor.Client.UpdateDesiredLRP方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。