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


Golang net.NewNotFoundApiResponse函數代碼示例

本文整理匯總了Golang中cf/net.NewNotFoundApiResponse函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewNotFoundApiResponse函數的具體用法?Golang NewNotFoundApiResponse怎麽用?Golang NewNotFoundApiResponse使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: FindServicePlanByDescription

func (repo CloudControllerServiceRepository) FindServicePlanByDescription(planDescription ServicePlanDescription) (planGuid string, apiResponse net.ApiResponse) {
	path := fmt.Sprintf("%s/v2/services?inline-relations-depth=1&q=label:%s;provider:%s",
		repo.config.ApiEndpoint(),
		planDescription.ServiceName,
		planDescription.ServiceProvider)

	response := new(PaginatedServiceOfferingResources)
	apiResponse = repo.gateway.GetResource(path, repo.config.AccessToken(), response)
	if apiResponse.IsNotSuccessful() {
		return
	}

	for _, serviceOfferingResource := range response.Resources {
		for _, servicePlanResource := range serviceOfferingResource.Entity.ServicePlans {
			if servicePlanResource.Entity.Name == planDescription.ServicePlanName {
				planGuid = servicePlanResource.Metadata.Guid
				return
			}
		}
	}

	apiResponse = net.NewNotFoundApiResponse("Plan %s cannot be found", planDescription)

	return
}
開發者ID:normalnorman,項目名稱:cli,代碼行數:25,代碼來源:services.go

示例2: FindByUsername

func (repo *FakeUserRepository) FindByUsername(username string) (user cf.UserFields, apiResponse net.ApiResponse) {
	repo.FindByUsernameUsername = username
	user = repo.FindByUsernameUserFields

	if repo.FindByUsernameNotFound {
		apiResponse = net.NewNotFoundApiResponse("UserFields not found")
	}

	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:10,代碼來源:fake_user_repo.go

示例3: FindByName

func (repo *FakeServiceBrokerRepo) FindByName(name string) (serviceBroker cf.ServiceBroker, apiResponse net.ApiResponse) {
	repo.FindByNameName = name
	serviceBroker = repo.FindByNameServiceBroker

	if repo.FindByNameNotFound {
		apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Service Broker", name)
	}

	return
}
開發者ID:jalateras,項目名稱:cli,代碼行數:10,代碼來源:fake_service_broker_repo.go

示例4: FindByName

func (repo *FakeBuildpackRepository) FindByName(name string) (buildpack cf.Buildpack, apiResponse net.ApiResponse) {
	repo.FindByNameName = name
	buildpack = repo.FindByNameBuildpack

	if repo.FindByNameNotFound {
		apiResponse = net.NewNotFoundApiResponse("Buildpack %s not found", name)
	}

	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:10,代碼來源:fake_buildpack_repo.go

示例5: TestMapDomainDomainNotFound

func TestMapDomainDomainNotFound(t *testing.T) {
	reqFactory, domainRepo := getDomainMapperDeps()
	domainRepo.FindByNameInOrgApiResponse = net.NewNotFoundApiResponse("Domain foo.com not found")
	ui := callDomainMapper(t, true, []string{"my-space", "foo.com"}, reqFactory, domainRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Mapping domain", "foo.com", "my-space"},
		{"FAILED"},
		{"Error finding", "foo.com"},
	})
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:11,代碼來源:domain_mapper_test.go

示例6: TestMapDomainDomainNotFound

func TestMapDomainDomainNotFound(t *testing.T) {
	reqFactory, domainRepo := getDomainMapperDeps()
	domainRepo.FindByNameInOrgApiResponse = net.NewNotFoundApiResponse("Domain foo.com not found")
	ui := callDomainMapper(t, true, []string{"my-space", "foo.com"}, reqFactory, domainRepo)

	assert.Equal(t, len(ui.Outputs), 3)
	assert.Contains(t, ui.Outputs[0], "Mapping domain")
	assert.Contains(t, ui.Outputs[0], "foo.com")
	assert.Contains(t, ui.Outputs[0], "my-space")
	assert.Contains(t, ui.Outputs[1], "FAILED")
	assert.Contains(t, ui.Outputs[2], "foo.com")
}
開發者ID:jalateras,項目名稱:cli,代碼行數:12,代碼來源:domain_mapper_test.go

示例7: FindByName

func (repo *FakeQuotaRepository) FindByName(name string) (quota cf.QuotaFields, apiResponse net.ApiResponse) {
	repo.FindByNameName = name
	quota = repo.FindByNameQuota

	if repo.FindByNameNotFound {
		apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Org", name)
	}
	if repo.FindByNameErr {
		apiResponse = net.NewApiResponseWithMessage("Error finding quota")
	}

	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:13,代碼來源:fake_quota_repo.go

示例8: FindByName

func (repo *FakeDomainRepository) FindByName(name string) (domain models.DomainFields, apiResponse net.ApiResponse) {
	repo.FindByNameName = name
	domain = repo.FindByNameDomain

	if repo.FindByNameNotFound {
		apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Domain", name)
	}
	if repo.FindByNameErr {
		apiResponse = net.NewApiResponseWithMessage("Error finding domain")
	}

	return
}
開發者ID:normalnorman,項目名稱:cli,代碼行數:13,代碼來源:fake_domain_repo.go

示例9: TestDeleteServiceAuthTokenWhenTokenDoesNotExist

func TestDeleteServiceAuthTokenWhenTokenDoesNotExist(t *testing.T) {
	authTokenRepo := &testapi.FakeAuthTokenRepo{
		FindByLabelAndProviderApiResponse: net.NewNotFoundApiResponse("not found"),
	}
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
	args := []string{"a label", "a provider"}

	ui := callDeleteServiceAuthToken(t, args, []string{"Y"}, reqFactory, authTokenRepo)
	assert.Contains(t, ui.Outputs[0], "Deleting service auth token as")
	assert.Contains(t, ui.Outputs[0], "my-user")
	assert.Contains(t, ui.Outputs[1], "OK")
	assert.Contains(t, ui.Outputs[2], "does not exist")
}
開發者ID:jalateras,項目名稱:cli,代碼行數:13,代碼來源:delete_service_auth_token_test.go

示例10: FindByName

func (repo *FakeSpaceRepository) FindByName(name string) (space cf.Space, apiResponse net.ApiResponse) {
	repo.FindByNameName = name
	space = repo.FindByNameSpace

	if repo.FindByNameErr {
		apiResponse = net.NewApiResponseWithMessage("Error finding space by name.")
	}

	if repo.FindByNameNotFound {
		apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Space", name)
	}

	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:14,代碼來源:fake_space_repo.go

示例11: GetEndpoint

func (repo RemoteEndpointRepository) GetEndpoint(name cf.EndpointType) (endpoint string, apiResponse net.ApiResponse) {
	switch name {
	case cf.CloudControllerEndpointKey:
		return repo.cloudControllerEndpoint()
	case cf.UaaEndpointKey:
		return repo.uaaControllerEndpoint()
	case cf.LoggregatorEndpointKey:
		return repo.loggregatorEndpoint()
	}

	apiResponse = net.NewNotFoundApiResponse("Endpoint type %s is unkown", string(name))

	return
}
開發者ID:jalateras,項目名稱:cli,代碼行數:14,代碼來源:endpoints.go

示例12: FindByName

func (repo CloudControllerDomainRepository) FindByName(name string) (domain cf.Domain, apiResponse net.ApiResponse) {
	path := fmt.Sprintf("/v2/domains?inline-relations-depth=1&q=%s", url.QueryEscape("name:"+name))
	domains, _, apiResponse := repo.findNextWithPath(path)
	if apiResponse.IsNotSuccessful() {
		return
	}

	if len(domains) > 0 {
		domain = domains[0]
	} else {
		apiResponse = net.NewNotFoundApiResponse("Domain %s not found", name)
	}
	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:14,代碼來源:domains.go

示例13: FindByNameInOrg

func (repo CloudControllerDomainRepository) FindByNameInOrg(name string, orgGuid string) (domain models.DomainFields, apiResponse net.ApiResponse) {
	domain, apiResponse = repo.findOneWithPath(
		fmt.Sprintf("/v2/organizations/%s/domains?inline-relations-depth=1&q=%s", orgGuid, url.QueryEscape("name:"+name)),
		name)

	if apiResponse.IsNotFound() {
		domain, apiResponse = repo.FindByName(name)
		if !domain.Shared {
			apiResponse = net.NewNotFoundApiResponse("Domain %s not found", name)
		}
	}

	return
}
開發者ID:normalnorman,項目名稱:cli,代碼行數:14,代碼來源:domains.go

示例14: findOneWithPath

func (repo CloudControllerDomainRepository) findOneWithPath(path, name string) (domain models.DomainFields, apiResponse net.ApiResponse) {
	foundDomain := false
	apiResponse = repo.listDomains(path, func(result models.DomainFields) bool {
		domain = result
		foundDomain = true
		return false
	})

	if apiResponse.IsSuccessful() && !foundDomain {
		apiResponse = net.NewNotFoundApiResponse("Domain %s not found", name)
	}

	return
}
開發者ID:normalnorman,項目名稱:cli,代碼行數:14,代碼來源:domains.go

示例15: FindByName

func (repo *FakeOrgRepository) FindByName(name string) (org cf.Organization, apiResponse net.ApiResponse) {
	repo.FindByNameName = name
	org = repo.FindByNameOrganization

	if repo.FindByNameErr {
		apiResponse = net.NewApiResponseWithMessage("Error finding organization by name.")
	}

	if repo.FindByNameNotFound {
		apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Org", name)
	}

	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:14,代碼來源:fake_org_repo.go


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