本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/models.DomainFields.Guid方法的典型用法代码示例。如果您正苦于以下问题:Golang DomainFields.Guid方法的具体用法?Golang DomainFields.Guid怎么用?Golang DomainFields.Guid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/cf/models.DomainFields
的用法示例。
在下文中一共展示了DomainFields.Guid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: fakeDomainRepo
func fakeDomainRepo() *testapi.FakeDomainRepository {
domain := models.DomainFields{}
domain.Name = "foo.com"
domain.Guid = "foo-guid"
domain.Shared = true
return &testapi.FakeDomainRepository{
FindByNameInOrgDomain: domain,
}
}
示例2: ToModel
func (resource RouteSummary) ToModel() (route models.RouteSummary) {
domain := models.DomainFields{}
domain.Guid = resource.Domain.Guid
domain.Name = resource.Domain.Name
domain.Shared = resource.Domain.OwningOrganizationGuid != ""
route.Guid = resource.Guid
route.Host = resource.Host
route.Domain = domain
return
}
示例3:
})
})
Context("when logged in and an org is targeted", func() {
BeforeEach(func() {
org := models.OrganizationFields{}
org.Name = "my-org"
app := models.ApplicationFields{}
app.Name = "app1"
app.Guid = "app1-guid"
apps := []models.ApplicationFields{app}
domain := models.DomainFields{}
domain.Name = "domain1"
domain.Guid = "domain1-guid"
domains := []models.DomainFields{domain}
serviceInstance := models.ServiceInstanceFields{}
serviceInstance.Name = "service1"
serviceInstance.Guid = "service1-guid"
services := []models.ServiceInstanceFields{serviceInstance}
securityGroup1 := models.SecurityGroupFields{Name: "Nacho Security"}
securityGroup2 := models.SecurityGroupFields{Name: "Nacho Prime"}
securityGroups := []models.SecurityGroupFields{securityGroup1, securityGroup2}
space := models.Space{}
space.Name = "whose-space-is-it-anyway"
space.Organization = org
space.Applications = apps
示例4:
Expect(handler).To(HaveAllRequestsCalled())
Expect(apiErr).NotTo(HaveOccurred())
})
It("finds a route by host and domain", func() {
ts, handler = testnet.NewServer([]testnet.TestRequest{
testapi.NewCloudControllerTestRequest(testnet.TestRequest{
Method: "GET",
Path: "/v2/routes?q=host%3Amy-cool-app%3Bdomain_guid%3Amy-domain-guid",
Response: findRouteByHostResponse,
}),
})
configRepo.SetApiEndpoint(ts.URL)
domain := models.DomainFields{}
domain.Guid = "my-domain-guid"
route, apiErr := repo.FindByHostAndDomain("my-cool-app", domain)
Expect(apiErr).NotTo(HaveOccurred())
Expect(handler).To(HaveAllRequestsCalled())
Expect(route.Host).To(Equal("my-cool-app"))
Expect(route.Guid).To(Equal("my-route-guid"))
Expect(route.Domain.Guid).To(Equal(domain.Guid))
})
It("returns 'not found' response when there is no route w/ the given domain and host", func() {
ts, handler = testnet.NewServer([]testnet.TestRequest{
testapi.NewCloudControllerTestRequest(testnet.TestRequest{
Method: "GET",
Path: "/v2/routes?q=host%3Amy-cool-app%3Bdomain_guid%3Amy-domain-guid",
示例5:
[]string{"Incorrect Usage", "Requires an argument"},
))
})
})
Context("when logged in, and provided the name of an org", func() {
BeforeEach(func() {
developmentSpaceFields := models.SpaceFields{}
developmentSpaceFields.Name = "development"
developmentSpaceFields.Guid = "dev-space-guid-1"
stagingSpaceFields := models.SpaceFields{}
stagingSpaceFields.Name = "staging"
stagingSpaceFields.Guid = "staging-space-guid-1"
domainFields := models.DomainFields{}
domainFields.Name = "cfapps.io"
domainFields.Guid = "1111"
domainFields.OwningOrganizationGuid = "my-org-guid"
domainFields.Shared = true
cfAppDomainFields := models.DomainFields{}
cfAppDomainFields.Name = "cf-app.com"
cfAppDomainFields.Guid = "2222"
cfAppDomainFields.OwningOrganizationGuid = "my-org-guid"
cfAppDomainFields.Shared = false
org := models.Organization{}
org.Name = "my-org"
org.Guid = "my-org-guid"
org.QuotaDefinition = models.NewQuotaFields("cantina-quota", 512, 256, 2, 5, true)
org.Spaces = []models.SpaceFields{developmentSpaceFields, stagingSpaceFields}
org.Domains = []models.DomainFields{domainFields, cfAppDomainFields}
org.SpaceQuotas = []models.SpaceQuota{
示例6:
[]string{"Creating route"},
[]string{"OK"},
[]string{"host.example.com", "already exists"},
))
Expect(routeRepo.CreateInSpaceHost).To(Equal("host"))
Expect(routeRepo.CreateInSpaceDomainGuid).To(Equal("domain-guid"))
Expect(routeRepo.CreateInSpaceSpaceGuid).To(Equal("my-space-guid"))
})
It("TestRouteCreator", func() {
space := models.SpaceFields{}
space.Guid = "my-space-guid"
space.Name = "my-space"
domain := models.DomainFields{}
domain.Guid = "domain-guid"
domain.Name = "example.com"
createdRoute := models.Route{}
createdRoute.Host = "my-host"
createdRoute.Guid = "my-route-guid"
routeRepo := &testapi.FakeRouteRepository{
CreateInSpaceCreatedRoute: createdRoute,
}
ui := new(testterm.FakeUI)
configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})
orgFields := models.OrganizationFields{}
orgFields.Name = "my-org"
configRepo.SetOrganizationFields(orgFields)