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


Golang Envelope.Job方法代碼示例

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


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

示例1: addDefaultTags

func addDefaultTags(envelope *events.Envelope) *events.Envelope {
	envelope.Deployment = proto.String("deployment-name")
	envelope.Job = proto.String("test-component")
	envelope.Index = proto.String("42")
	envelope.Ip = proto.String(localIPAddress)

	return envelope
}
開發者ID:kei-yamazaki,項目名稱:loggregator,代碼行數:8,代碼來源:helpers_test.go

示例2: basicTaggedHttpStartStopMessage

func basicTaggedHttpStartStopMessage(envelope events.Envelope) *events.Envelope {
	ip, _ := localip.LocalIP()

	envelope.Deployment = proto.String("test-deployment")
	envelope.Job = proto.String("test-job")
	envelope.Index = proto.String("2")
	envelope.Ip = proto.String(ip)

	return &envelope
}
開發者ID:khj0651,項目名稱:loggregator,代碼行數:10,代碼來源:tagger_test.go

示例3: setDefaultTags

func (t *Tagger) setDefaultTags(envelope *events.Envelope) {
	if envelope.Deployment == nil {
		envelope.Deployment = proto.String(t.deploymentName)
	}
	if envelope.Job == nil {
		envelope.Job = proto.String(t.job)
	}
	if envelope.Index == nil {
		envelope.Index = proto.String(t.index)
	}
	if envelope.Ip == nil {
		envelope.Ip = proto.String(t.ip)
	}
}
開發者ID:kei-yamazaki,項目名稱:loggregator,代碼行數:14,代碼來源:tagger.go

示例4:

			t = tagger.New("test-deployment", "test-job", 2, mockWriter)

			envelope = basicMessage()
		})

		It("when deployment is already set", func() {
			envelope.Deployment = proto.String("another-deployment")
			t.Write(envelope)

			Expect(mockWriter.Events).To(HaveLen(1))
			writtenEnvelope := mockWriter.Events[0]
			Eventually(*writtenEnvelope.Deployment).Should(Equal("another-deployment"))
		})

		It("when job is already set", func() {
			envelope.Job = proto.String("another-job")
			t.Write(envelope)

			Expect(mockWriter.Events).To(HaveLen(1))
			writtenEnvelope := mockWriter.Events[0]
			Eventually(*writtenEnvelope.Job).Should(Equal("another-job"))
		})

		It("when index is already set", func() {
			envelope.Index = proto.String("3")
			t.Write(envelope)

			Expect(mockWriter.Events).To(HaveLen(1))
			writtenEnvelope := mockWriter.Events[0]
			Eventually(*writtenEnvelope.Index).Should(Equal("3"))
		})
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:31,代碼來源:tagger_test.go


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