我们想使用 Kubernetes for Microservices 和 Google Cloud Endpoints 作为 API 管理层。
如果我理解得很好,要拥有 Google Cloud Endpoints 功能,我们需要为真正的微服务提供一个 sidecar 或代理。(图片:gcr.io/endpoints-release/endpoints-runtime:1)
那么如果我们使用 Istio 作为服务网格技术,Envoy 代理将如何与 Google Cloud Endpoint 一起工作?它实际上会代理甚至谷歌云端点相关的容器吗?
或者这是一个糟糕的策略?
cloud google-cloud-endpoints kubernetes google-kubernetes-engine istio
在 Golang 中,是否有一种更简洁的方法来实现围绕 oneOf、anyOf、allOf 的 OpenAPI 3.0 构造。我觉得拥有一个带有鉴别器字段的扁平结构是明智的。(下例)
package main
import (
"encoding/json"
"fmt"
)
type OneOfCertification struct {
AssetType string `json:"assetType"`
CertDetails *json.RawMessage `json:"certDetails"`
}
type FlatCertification struct {
AssetType string `json:"assetType"`
DiamondCert *Diamond `json:"diamondCert,omitempty"`
GemCert *Gem `json:"gemCert,omitempty"`
}
type Diamond struct {
DiamondAttr string `json:"diamondAttr"`
}
type Gem struct {
GemAttr string `json:"gemAttr"`
}
func oneOfUnmarshalMarshal(data []byte) ([]byte, error) {
var cert OneOfCertification
json.Unmarshal(data, &cert)
switch cert.AssetType {
case "DIA":
var dia Diamond
json.Unmarshal(*cert.CertDetails, &dia)
fmt.Println("(oneOf) Diamond Cert …Run Code Online (Sandbox Code Playgroud)