本文整理匯總了Golang中github.com/cloudfoundry-incubator/runtime-schema/cc_messages.DesireAppRequestFromCC類的典型用法代碼示例。如果您正苦於以下問題:Golang DesireAppRequestFromCC類的具體用法?Golang DesireAppRequestFromCC怎麽用?Golang DesireAppRequestFromCC使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DesireAppRequestFromCC類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"github.com/cloudfoundry-incubator/diego-ssh/keys/fake_keys"
"github.com/cloudfoundry-incubator/diego-ssh/routes"
"github.com/cloudfoundry-incubator/nsync/recipebuilder"
"github.com/cloudfoundry-incubator/routing-info/cfroutes"
"github.com/cloudfoundry-incubator/runtime-schema/cc_messages"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager/lagertest"
)
var _ = Describe("Buildpack Recipe Builder", func() {
var (
builder *recipebuilder.BuildpackRecipeBuilder
err error
desiredAppReq cc_messages.DesireAppRequestFromCC
lifecycles map[string]string
egressRules []*models.SecurityGroupRule
fakeKeyFactory *fake_keys.FakeSSHKeyFactory
logger *lagertest.TestLogger
)
defaultNofile := recipebuilder.DefaultFileDescriptorLimit
BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
lifecycles = map[string]string{
"buildpack/some-stack": "some-lifecycle.tgz",
"docker": "the/docker/lifecycle/path.tgz",
}
示例2:
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("DesireAppHandler", func() {
var (
logger *lagertest.TestLogger
fakeBBS *fake_bbs.FakeClient
buildpackBuilder *fakes.FakeRecipeBuilder
dockerBuilder *fakes.FakeRecipeBuilder
desireAppRequest cc_messages.DesireAppRequestFromCC
metricSender *fake.FakeMetricSender
request *http.Request
responseRecorder *httptest.ResponseRecorder
)
BeforeEach(func() {
var err error
logger = lagertest.NewTestLogger("test")
fakeBBS = new(fake_bbs.FakeClient)
buildpackBuilder = new(fakes.FakeRecipeBuilder)
dockerBuilder = new(fakes.FakeRecipeBuilder)
routingInfo, err := cc_messages.CCHTTPRoutes{
示例3:
egressRules = []*models.SecurityGroupRule{
{
Protocol: "TCP",
Destinations: []string{"0.0.0.0/0"},
PortRange: &models.PortRange{Start: 80, End: 443},
},
}
fakeKeyFactory = &fake_keys.FakeSSHKeyFactory{}
config := recipebuilder.Config{lifecycles, "http://file-server.com", fakeKeyFactory}
builder = recipebuilder.NewDockerRecipeBuilder(logger, config)
})
Context("Build", func() {
var (
err error
desiredAppReq cc_messages.DesireAppRequestFromCC
desiredLRP *models.DesiredLRP
)
BeforeEach(func() {
routingInfo, err := cc_messages.CCHTTPRoutes{
{Hostname: "route1"},
{Hostname: "route2"},
}.CCRouteInfo()
Expect(err).NotTo(HaveOccurred())
desiredAppReq = cc_messages.DesireAppRequestFromCC{
ProcessGuid: "the-app-guid-the-app-version",
Stack: "some-stack",
StartCommand: "the-start-command with-arguments",
DockerImageUrl: "user/repo:tag",
示例4:
cancel <-chan struct{},
httpClient *http.Client,
fingerprints <-chan []cc_messages.CCDesiredAppFingerprint,
) (<-chan []cc_messages.DesireAppRequestFromCC, <-chan error) {
batch := <-fingerprints
results := []cc_messages.DesireAppRequestFromCC{}
for _, fingerprint := range batch {
routeInfo, err := cc_messages.CCHTTPRoutes{
{Hostname: "host-" + fingerprint.ProcessGuid},
}.CCRouteInfo()
Expect(err).NotTo(HaveOccurred())
lrp := cc_messages.DesireAppRequestFromCC{
ProcessGuid: fingerprint.ProcessGuid,
ETag: fingerprint.ETag,
RoutingInfo: routeInfo,
}
if strings.HasPrefix(fingerprint.ProcessGuid, "docker") {
lrp.DockerImageUrl = "some-image"
}
results = append(results, lrp)
}
desired := make(chan []cc_messages.DesireAppRequestFromCC, 1)
desired <- results
close(desired)
errors := make(chan error, 1)
close(errors)