// IsProtocolReserved reports whether the code is defined by protocol specification
// to be reserved only for application usage purpose.
189730
func (s StatusCode) IsProtocolReserved() bool {
	switch s {
	// [RFC6455]: {1005,1006,1015} is a reserved value and MUST NOT be set as a status code in a
	// Close control frame by an endpoint.
	case StatusNoStatusRcvd, StatusAbnormalClosure, StatusTLSHandshake:
		return true
	default:
		return false
	}
}
650553
func (c *Cors) isMethodAllowed(method string) bool {
	if len(c.allowedMethods) == 0 {
		// If no method allowed, always return false, even for preflight request
		return false
	}
	method = strings.ToUpper(method)
	if method == "OPTIONS" {
		// Always allow preflight requests
		return true
	}
	for _, m := range c.allowedMethods {
		if m == method {
			return true
		}
	}
	return false
}
1233811
func (s *SetSourceRequest) SetProtocol(v string) *SetSourceRequest {
	s.Protocol = &v
	return s
}
200592
func validateProtocol(protocol string) bool {
	if protocol == ProtocolTCP || protocol == ProtocolUDP || protocol == ProtocolSCTP {
		return true
	}
	klog.Errorf("Invalid entry's protocol: %s, supported protocols are [%s, %s, %s]", protocol, ProtocolTCP, ProtocolUDP, ProtocolSCTP)
	return false
}
1094505
func (s *UpdateApiOutput) SetProtocolType(v string) *UpdateApiOutput {
	s.ProtocolType = &v
	return s
}
439782
func (r *Request) SetProtocolVersion(vers string) *Request {
	if len(vers) == 0 {
		vers = "HTTP/1.1"
	}

	major, minor, ok := http.ParseHTTPVersion(vers)
	if ok {
		r.req.Proto = vers
		r.req.ProtoMajor = major
		r.req.ProtoMinor = minor
	}

	return r
}
464513
func (c *Client) GetReservedIP(id string) (IP, error) {
	var ipMap map[string]IP

	err := c.get(`reservedip/list`, &ipMap)
	if err != nil {
		return IP{}, err
	}
	if ip, ok := ipMap[id]; ok {
		return ip, nil
	}
	return IP{}, fmt.Errorf("IP with ID %v not found", id)
}
1078423
func RegisterProtocol(protocol string, f ALTSRecordFunc) error {
	if _, ok := protocols[protocol]; ok {
		return fmt.Errorf("protocol %v is already registered", protocol)
	}
	protocols[protocol] = f
	return nil
}
258410
func (s *OriginationRoute) SetProtocol(v string) *OriginationRoute {
	s.Protocol = &v
	return s
}
737289
func (c *Client) ConvertReservedIP(serverID string, ip string) (string, error) {
	values := url.Values{
		"SUBID":      {serverID},
		"ip_address": {ip},
	}

	result := IP{}
	err := c.post(`reservedip/convert`, values, &result)
	if err != nil {
		return "", err
	}
	return result.ID, err
}
476666
func (c *Client) CreateReservedIP(regionID int, ipType string, label string) (string, error) {
	values := url.Values{
		"DCID":    {fmt.Sprintf("%v", regionID)},
		"ip_type": {ipType},
	}
	if len(label) > 0 {
		values.Add("label", label)
	}

	result := IP{}
	err := c.post(`reservedip/create`, values, &result)
	if err != nil {
		return "", err
	}
	return result.ID, nil
}
1294354
func (s *GetApiOutput) SetProtocolType(v string) *GetApiOutput {
	s.ProtocolType = &v
	return s
}
1122590
func (o *ObjectConstraint) IsPropRequired(s string) bool {
	o.reqlock.Lock()
	defer o.reqlock.Unlock()

	_, ok := o.required[s]
	return ok
}
749662
func (s *Transport) SetProtocol(v string) *Transport {
	s.Protocol = &v
	return s
}
17605
func (s *InstancePortState) SetProtocol(v string) *InstancePortState {
	s.Protocol = &v
	return s
}
1118707
func (s *Api) SetProtocolType(v string) *Api {
	s.ProtocolType = &v
	return s
}
582908
func IsPermissionDenied(err error) bool {
	pd, ok := err.(permissionDeniedError)
	return ok && pd.IsPermissionDenied()
}