// DescribeLivePullStreamConfig 查询域名下拉流配置信息
//
// https://help.aliyun.com/document_detail/57733.html?spm=5176.doc57735.6.658.8TrTGR
770391
func (l *Live) DescribeLivePullStreamConfig(resp interface{}) (err error) {
	req := l.cloneRequest(DescribeLivePullStreamConfigAction)
	err = l.rpc.Query(req, resp)
	return
}
51400
func (cml *ConfigMapLock) Describe() string {
	return fmt.Sprintf("%v/%v", cml.ConfigMapMeta.Namespace, cml.ConfigMapMeta.Name)
}
284561
func (ec2i *FakeEC2Impl) DescribeVpcs(request *ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) {
	return &ec2.DescribeVpcsOutput{Vpcs: []*ec2.Vpc{{CidrBlock: aws.String("172.20.0.0/16")}}}, nil
}
208673
func DescribePlugins() string {
	pl := ListPlugins()

	str := "Server types:\n"
	for _, name := range pl["server_types"] {
		str += "  " + name + "\n"
	}

	str += "\nCaddyfile loaders:\n"
	for _, name := range pl["caddyfile_loaders"] {
		str += "  " + name + "\n"
	}

	if len(pl["event_hooks"]) > 0 {
		str += "\nEvent hook plugins:\n"
		for _, name := range pl["event_hooks"] {
			str += "  hook." + name + "\n"
		}
	}

	if len(pl["clustering"]) > 0 {
		str += "\nClustering plugins:\n"
		for _, name := range pl["clustering"] {
			str += "  " + name + "\n"
		}
	}

	str += "\nOther plugins:\n"
	for _, name := range pl["others"] {
		str += "  " + name + "\n"
	}

	return str
}
651097
func (l *Live) DescribeLiveDomainTrafficData(startTime, endTime time.Time, resp interface{}) (err error) {
	req := l.cloneRequest(DescribeLiveDomainTrafficDataAction)
	req.SetArgs("StartTime", util.GetISO8601TimeStamp(startTime))
	req.SetArgs("EndTime", util.GetISO8601TimeStamp(endTime))
	err = l.rpc.Query(req, resp)
	return
}
490399
func (h *portForwardProxy) getStreamPair(requestID string) (*httpStreamPair, bool) {
	h.streamPairsLock.Lock()
	defer h.streamPairsLock.Unlock()

	if p, ok := h.streamPairs[requestID]; ok {
		log.Infof("(conn=%p, request=%s) found existing stream pair", h.sourceConn, requestID)
		return p, false
	}

	log.Infof("(conn=%p, request=%s) creating new stream pair", h.sourceConn, requestID)

	p := newPortForwardPair(requestID)
	h.streamPairs[requestID] = p

	return p, true
}
1156673
func getStreamingConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps *Dependencies, crOptions *config.ContainerRuntimeOptions) *streaming.Config {
	config := &streaming.Config{
		StreamIdleTimeout:               kubeCfg.StreamingConnectionIdleTimeout.Duration,
		StreamCreationTimeout:           streaming.DefaultConfig.StreamCreationTimeout,
		SupportedRemoteCommandProtocols: streaming.DefaultConfig.SupportedRemoteCommandProtocols,
		SupportedPortForwardProtocols:   streaming.DefaultConfig.SupportedPortForwardProtocols,
	}
	if !crOptions.RedirectContainerStreaming {
		config.Addr = net.JoinHostPort("localhost", "0")
	} else {
		// Use a relative redirect (no scheme or host).
		config.BaseURL = &url.URL{
			Path: "/cri/",
		}
		if kubeDeps.TLSOptions != nil {
			config.TLSConfig = kubeDeps.TLSOptions.Config
		}
	}
	return config
}
184765
func (bs *Bootstrap) GetViewerURLForStreams(streams ...streamclient.Stream) (string, error) {
	if bs.Prefix == "" {
		return "", errors.New("no prefix is configured")
	}

	paths := make([]types.StreamPath, len(streams))
	for i, s := range streams {
		paths[i] = bs.Prefix.Join(types.StreamName(s.Properties().Name))
	}
	return bs.GetViewerURL(paths...)
}
1258593
func StreamExample() {
	cert := aliyun.NewCredentials(AccessKeyID, AccessKeySecret)
	streamCert := live.NewStreamCredentials(PrivateKey, live.DefaultStreamTimeout)
	liveM := live.NewLive(cert, DomainName, AppName, streamCert).SetDebug(false)
	stream := liveM.GetStream("test-video-name")
	stream.RtmpPublishUrl()

	fmt.Println("Online", stream.Online())
	fmt.Println("Blocked", stream.Blocked())
	fmt.Println(stream.String())

	stream1 := liveM.GetStream("test-video-name1")
	fmt.Println("Blocked", stream1.Blocked())

	oss := live.OssInfo{
		OssBucket:       OssBucket,
		OssEndpoint:     OssEndpoint,
		OssObject:       OssObject,
		OssObjectPrefix: OssObjectPrefix,
	}

	//录制
	fmt.Println(stream1.CreateRecordIndexFiles(oss, time.Now().Add(-time.Hour*24*10), time.Now()))

	fmt.Println(stream1.RecordContent(time.Now().Add(-time.Hour*24*20), time.Now()))

	fmt.Println(stream1.RecordIndexFiles(time.Now().Add(-time.Hour*24*20), time.Now()))

	fmt.Println(stream1.FrameRateAndBitRateData())

	//截图
	fmt.Println("查询截图信息：")
	fmt.Println(stream1.SnapshotInfo(time.Now().Add(-time.Hour*24*20), time.Now(), 10))

	fmt.Println(stream1.StartMultipleStreamMixService("pip4a"))

	fmt.Println(stream1.StopMultipleStreamMixService())

	fmt.Println(stream1.AddMultipleStream(
		live.StreamBase{
			LiveBase: live.LiveBase{
				DomainName: DomainName,
				AppName:    AppName,
			},
			StreamName: "test-video-name-mix",
		},
	))

	fmt.Println(stream1.RemoveMultipleStream(
		live.StreamBase{
			LiveBase: live.LiveBase{
				DomainName: DomainName,
				AppName:    AppName,
			},
			StreamName: "test-video-name-mix",
		},
	))
}
1189979
func DefaultConfig() Config {
	return Config{
		Indent:        false,
		UnEscapeHTML:  false,
		Prefix:        []byte(""),
		StreamingJSON: false,
	}
}
1187878
func (client *Client) DescribeLoadBalancerHTTPListenerAttribute(loadBalancerId string, port int) (response *DescribeLoadBalancerHTTPListenerAttributeResponse, err error) {
	args := &CommonLoadBalancerListenerArgs{
		LoadBalancerId: loadBalancerId,
		ListenerPort:   port,
	}
	response = &DescribeLoadBalancerHTTPListenerAttributeResponse{}
	err = client.Invoke("DescribeLoadBalancerHTTPListenerAttribute", args, response)
	if err != nil {
		return nil, err
	}
	return response, err
}
1445
func (l *Live) DescribeLiveStreamRecordIndexFile(streamName, recordID string, resp interface{}) (err error) {
	req := l.cloneRequest(DescribeLiveStreamRecordIndexFileAction)
	if global.EmptyString == req.AppName || global.EmptyString == streamName {
		return errors.New(" appName|streamName should not to be empty")
	}
	req.SetArgs("StreamName", streamName)
	if recordID != global.EmptyString {
		req.SetArgs("RecordId", recordID)
	}
	err = l.rpc.Query(req, resp)
	return
}
1036487
func (l *Live) DescribeLiveStreamHistoryUserNum(streamName string, startTime, endTime time.Time, resp interface{}) (err error) {
	req := l.cloneRequest(DescribeLiveStreamHistoryUserNumAction)
	req.SetArgs("StreamName", streamName)
	req.SetArgs("StartTime", util.GetISO8601TimeStamp(startTime))
	req.SetArgs("EndTime", util.GetISO8601TimeStamp(endTime))
	err = l.rpc.Query(req, resp)
	return
}
1118722
func (d *ImageStreamImageDescriber) Describe(namespace, name string, settings describe.DescriberSettings) (string, error) {
	c := d.c.ImageStreamImages(namespace)
	imageStreamImage, err := c.Get(name, metav1.GetOptions{})
	if err != nil {
		return "", err
	}

	return DescribeImage(&imageStreamImage.Image, imageStreamImage.Image.Name)
}
1228136
func NewStreamConfig() *StreamConfig {
	return &StreamConfig{
		stderr: new(broadcaster.Unbuffered),
		stdout: new(broadcaster.Unbuffered),
	}
}
526041
func StreamServerInterceptor(authFunc AuthFunc) grpc.StreamServerInterceptor {
	return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
		var newCtx context.Context
		var err error
		if overrideSrv, ok := srv.(ServiceAuthFuncOverride); ok {
			newCtx, err = overrideSrv.AuthFuncOverride(stream.Context(), info.FullMethod)
		} else {
			newCtx, err = authFunc(stream.Context())
		}
		if err != nil {
			return err
		}
		wrapped := grpc_middleware.WrapServerStream(stream)
		wrapped.WrappedContext = newCtx
		return handler(srv, wrapped)
	}
}
1045496
func (client *Client) DescribeLoadBalancers(args *DescribeLoadBalancersArgs) (loadBalancers []LoadBalancerType, err error) {
	response := &DescribeLoadBalancersResponse{}
	err = client.Invoke("DescribeLoadBalancers", args, response)
	if err != nil {
		return nil, err
	}
	return response.LoadBalancers.LoadBalancer, err
}