// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export.
172120
func (m *Oauth2AccessCodeSecurity) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if m == nil {
		return info
	}
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "flow", Value: m.Flow})
	if m.Scopes != nil {
		info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
	}
	// &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "authorizationUrl", Value: m.AuthorizationUrl})
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "tokenUrl", Value: m.TokenUrl})
	if m.Description != "" {
		info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
	}
	if m.VendorExtension != nil {
		for _, item := range m.VendorExtension {
			info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
		}
	}
	// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
	return info
}
402297
func (m *Link) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if m == nil {
		return info
	}
	if m.OperationRef != "" {
		info = append(info, yaml.MapItem{Key: "operationRef", Value: m.OperationRef})
	}
	if m.OperationId != "" {
		info = append(info, yaml.MapItem{Key: "operationId", Value: m.OperationId})
	}
	if m.Parameters != nil {
		info = append(info, yaml.MapItem{Key: "parameters", Value: m.Parameters.ToRawInfo()})
	}
	// &{Name:parameters Type:AnysOrExpressions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.RequestBody != nil {
		info = append(info, yaml.MapItem{Key: "requestBody", Value: m.RequestBody.ToRawInfo()})
	}
	// &{Name:requestBody Type:AnyOrExpression StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.Description != "" {
		info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
	}
	if m.Server != nil {
		info = append(info, yaml.MapItem{Key: "server", Value: m.Server.ToRawInfo()})
	}
	// &{Name:server Type:Server StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.SpecificationExtension != nil {
		for _, item := range m.SpecificationExtension {
			info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
		}
	}
	// &{Name:SpecificationExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
	return info
}
1165701
func (m *DefaultType) ToRawInfo() interface{} {
	// ONE OF WRAPPER
	// DefaultType
	// {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if v0, ok := m.GetOneof().(*DefaultType_Number); ok {
		return v0.Number
	}
	// {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if v1, ok := m.GetOneof().(*DefaultType_Boolean); ok {
		return v1.Boolean
	}
	// {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if v2, ok := m.GetOneof().(*DefaultType_String_); ok {
		return v2.String_
	}
	return nil
}
971092
func (m *Strings) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if m == nil {
		return info
	}
	// &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}
	return info
}
485910
func (p *Provider) UserInfo(ctx context.Context, tokenSource oauth2.TokenSource) (*UserInfo, error) {
	if p.userInfoURL == "" {
		return nil, errors.New("oidc: user info endpoint is not supported by this provider")
	}

	req, err := http.NewRequest("GET", p.userInfoURL, nil)
	if err != nil {
		return nil, fmt.Errorf("oidc: create GET request: %v", err)
	}

	token, err := tokenSource.Token()
	if err != nil {
		return nil, fmt.Errorf("oidc: get access token: %v", err)
	}
	token.SetAuthHeader(req)

	resp, err := doRequest(ctx, req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("%s: %s", resp.Status, body)
	}

	var userInfo UserInfo
	if err := json.Unmarshal(body, &userInfo); err != nil {
		return nil, fmt.Errorf("oidc: failed to decode userinfo: %v", err)
	}
	userInfo.claims = body
	return &userInfo, nil
}
426187
func (m *Document) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if m == nil {
		return info
	}
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "swagger", Value: m.Swagger})
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "info", Value: m.Info.ToRawInfo()})
	// &{Name:info Type:Info StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.Host != "" {
		info = append(info, yaml.MapItem{Key: "host", Value: m.Host})
	}
	if m.BasePath != "" {
		info = append(info, yaml.MapItem{Key: "basePath", Value: m.BasePath})
	}
	if len(m.Schemes) != 0 {
		info = append(info, yaml.MapItem{Key: "schemes", Value: m.Schemes})
	}
	if len(m.Consumes) != 0 {
		info = append(info, yaml.MapItem{Key: "consumes", Value: m.Consumes})
	}
	if len(m.Produces) != 0 {
		info = append(info, yaml.MapItem{Key: "produces", Value: m.Produces})
	}
	// always include this required field.
	info = append(info, yaml.MapItem{Key: "paths", Value: m.Paths.ToRawInfo()})
	// &{Name:paths Type:Paths StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.Definitions != nil {
		info = append(info, yaml.MapItem{Key: "definitions", Value: m.Definitions.ToRawInfo()})
	}
	// &{Name:definitions Type:Definitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.Parameters != nil {
		info = append(info, yaml.MapItem{Key: "parameters", Value: m.Parameters.ToRawInfo()})
	}
	// &{Name:parameters Type:ParameterDefinitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.Responses != nil {
		info = append(info, yaml.MapItem{Key: "responses", Value: m.Responses.ToRawInfo()})
	}
	// &{Name:responses Type:ResponseDefinitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if len(m.Security) != 0 {
		items := make([]interface{}, 0)
		for _, item := range m.Security {
			items = append(items, item.ToRawInfo())
		}
		info = append(info, yaml.MapItem{Key: "security", Value: items})
	}
	// &{Name:security Type:SecurityRequirement StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
	if m.SecurityDefinitions != nil {
		info = append(info, yaml.MapItem{Key: "securityDefinitions", Value: m.SecurityDefinitions.ToRawInfo()})
	}
	// &{Name:securityDefinitions Type:SecurityDefinitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if len(m.Tags) != 0 {
		items := make([]interface{}, 0)
		for _, item := range m.Tags {
			items = append(items, item.ToRawInfo())
		}
		info = append(info, yaml.MapItem{Key: "tags", Value: items})
	}
	// &{Name:tags Type:Tag StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
	if m.ExternalDocs != nil {
		info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
	}
	// &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.VendorExtension != nil {
		for _, item := range m.VendorExtension {
			info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
		}
	}
	// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
	return info
}
1120815
func (c *Controller) getAuthCookie() ([]byte, error) {
	// Retrieve the authentication methods currently supported by the Tor
	// server.
	authMethods, cookieFilePath, version, err := c.ProtocolInfo()
	if err != nil {
		return nil, err
	}

	// With the version retrieved, we'll cache it now in case it needs to be
	// used later on.
	c.version = version

	// Ensure that the Tor server supports the SAFECOOKIE authentication
	// method or the NULL method. If NULL, we don't need the cookie info
	// below this loop, so we just return.
	safeCookieSupport := false
	for _, authMethod := range authMethods {
		if authMethod == "SAFECOOKIE" {
			safeCookieSupport = true
		}
		if authMethod == "NULL" {
			return nil, nil
		}
	}

	if !safeCookieSupport {
		return nil, errors.New("the Tor server is currently not " +
			"configured for cookie or null authentication")
	}

	// Read the cookie from the file and ensure it has the correct length.
	cookie, err := ioutil.ReadFile(cookieFilePath)
	if err != nil {
		return nil, err
	}

	if len(cookie) != cookieLen {
		return nil, errors.New("invalid authentication cookie length")
	}

	return cookie, nil
}
978419
func (m *CallbackOrReference) ToRawInfo() interface{} {
	// ONE OF WRAPPER
	// CallbackOrReference
	// {Name:callback Type:Callback StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	v0 := m.GetCallback()
	if v0 != nil {
		return v0.ToRawInfo()
	}
	// {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	v1 := m.GetReference()
	if v1 != nil {
		return v1.ToRawInfo()
	}
	return nil
}
935643
func (m *SchemaItem) ToRawInfo() interface{} {
	// ONE OF WRAPPER
	// SchemaItem
	// {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	v0 := m.GetSchema()
	if v0 != nil {
		return v0.ToRawInfo()
	}
	// {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	v1 := m.GetFileSchema()
	if v1 != nil {
		return v1.ToRawInfo()
	}
	return nil
}
447369
func (m *HeaderOrReference) ToRawInfo() interface{} {
	// ONE OF WRAPPER
	// HeaderOrReference
	// {Name:header Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	v0 := m.GetHeader()
	if v0 != nil {
		return v0.ToRawInfo()
	}
	// {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	v1 := m.GetReference()
	if v1 != nil {
		return v1.ToRawInfo()
	}
	return nil
}
217059
func (config *DirectClientConfig) getAuthInfo() (clientcmdapi.AuthInfo, error) {
	authInfos := config.config.AuthInfos
	authInfoName, required := config.getAuthInfoName()

	mergedAuthInfo := clientcmdapi.NewAuthInfo()
	if configAuthInfo, exists := authInfos[authInfoName]; exists {
		mergo.MergeWithOverwrite(mergedAuthInfo, configAuthInfo)
	} else if required {
		return clientcmdapi.AuthInfo{}, fmt.Errorf("auth info %q does not exist", authInfoName)
	}
	mergo.MergeWithOverwrite(mergedAuthInfo, config.overrides.AuthInfo)

	return *mergedAuthInfo, nil
}
167429
func (a *ACLTokens) Info(accessorID string, q *QueryOptions) (*ACLToken, *QueryMeta, error) {
	if accessorID == "" {
		return nil, nil, fmt.Errorf("missing accessor ID")
	}
	var resp ACLToken
	wm, err := a.client.query("/v1/acl/token/"+accessorID, &resp, q)
	if err != nil {
		return nil, nil, err
	}
	return &resp, wm, nil
}
1060189
func (m *MediaUpload) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if len(m.Accept) != 0 {
		info = append(info, yaml.MapItem{Key: "accept", Value: m.Accept})
	}
	if m.MaxSize != "" {
		info = append(info, yaml.MapItem{Key: "maxSize", Value: m.MaxSize})
	}
	if m.Protocols != nil {
		info = append(info, yaml.MapItem{Key: "protocols", Value: m.Protocols.ToRawInfo()})
	}
	// &{Name:protocols Type:Protocols StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.SupportsSubscription != false {
		info = append(info, yaml.MapItem{Key: "supportsSubscription", Value: m.SupportsSubscription})
	}
	return info
}
1106416
func (c *Client) OAuthAuthorizationInfo(oauthAuthorizationIdentity string) (*OAuthAuthorization, error) {
	var oauthAuthorization OAuthAuthorization
	return &oauthAuthorization, c.Get(&oauthAuthorization, "/oauth/authorizations/"+oauthAuthorizationIdentity)
}
692338
func (p *Provider) UserInfo(ctx context.Context, tokenSource oauth2.TokenSource) (*UserInfo, error) {
	if p.UserInfoURL == "" {
		return nil, ErrNotSupported
	}
	cli := oauth2.NewClient(ctx, tokenSource)
	resp, err := cli.Get(p.UserInfoURL)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("%s: %s", resp.Status, body)
	}

	var userInfo UserInfo
	if err := json.Unmarshal(body, &userInfo); err != nil {
		return nil, fmt.Errorf("oidc: failed to decode userinfo: %v", err)
	}
	userInfo.claims = body
	return &userInfo, nil
}
1174345
func (m *Response) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if m.XRef != "" {
		info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
	}
	return info
}
652293
func (m *OauthFlows) ToRawInfo() interface{} {
	info := yaml.MapSlice{}
	if m == nil {
		return info
	}
	if m.Implicit != nil {
		info = append(info, yaml.MapItem{Key: "implicit", Value: m.Implicit.ToRawInfo()})
	}
	// &{Name:implicit Type:OauthFlow StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.Password != nil {
		info = append(info, yaml.MapItem{Key: "password", Value: m.Password.ToRawInfo()})
	}
	// &{Name:password Type:OauthFlow StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.ClientCredentials != nil {
		info = append(info, yaml.MapItem{Key: "clientCredentials", Value: m.ClientCredentials.ToRawInfo()})
	}
	// &{Name:clientCredentials Type:OauthFlow StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.AuthorizationCode != nil {
		info = append(info, yaml.MapItem{Key: "authorizationCode", Value: m.AuthorizationCode.ToRawInfo()})
	}
	// &{Name:authorizationCode Type:OauthFlow StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
	if m.SpecificationExtension != nil {
		for _, item := range m.SpecificationExtension {
			info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
		}
	}
	// &{Name:SpecificationExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
	return info
}