github.com/vmware/go-vmware-nsxt@v0.0.0-20230223012718-d31b8a1ca05e/configuration.go (about)

     1  /* Copyright © 2017 VMware, Inc. All Rights Reserved.
     2     SPDX-License-Identifier: BSD-2-Clause
     3  
     4     Generated by: https://github.com/swagger-api/swagger-codegen.git */
     5  
     6  package nsxt
     7  
     8  import (
     9  	"net/http"
    10  )
    11  
    12  const ContextOAuth2 int = 1
    13  const ContextBasicAuth int = 2
    14  const ContextAccessToken int = 3
    15  const ContextAPIKey int = 4
    16  
    17  type BasicAuth struct {
    18  	UserName string `json:"userName,omitempty"`
    19  	Password string `json:"password,omitempty"`
    20  }
    21  
    22  type APIKey struct {
    23  	Key    string
    24  	Prefix string
    25  }
    26  
    27  type ClientRetriesConfiguration struct {
    28  	MaxRetries      int
    29  	RetryMinDelay   int // milliseconds
    30  	RetryMaxDelay   int // milliseconds
    31  	RetryOnStatuses []int
    32  }
    33  
    34  type Configuration struct {
    35  	BasePath             string `json:"basePath,omitempty"`
    36  	Host                 string `json:"host,omitempty"`
    37  	Scheme               string `json:"scheme,omitempty"`
    38  	UserName             string
    39  	Password             string
    40  	RemoteAuth           bool
    41  	DefaultHeader        map[string]string `json:"defaultHeader,omitempty"`
    42  	UserAgent            string            `json:"userAgent,omitempty"`
    43  	ClientAuthCertFile   string
    44  	ClientAuthKeyFile    string
    45  	CAFile               string
    46  	ClientAuthCertString string
    47  	ClientAuthKeyString  string
    48  	CAString             string
    49  	Insecure             bool
    50  	SkipSessionAuth      bool
    51  	RetriesConfiguration ClientRetriesConfiguration
    52  	HTTPClient           *http.Client
    53  }
    54  
    55  func NewConfiguration() *Configuration {
    56  	cfg := &Configuration{
    57  		BasePath:      "https://nsxmanager.your.domain/api/v1",
    58  		DefaultHeader: make(map[string]string),
    59  		UserAgent:     "Swagger-Codegen/1.0.0/go",
    60  	}
    61  	return cfg
    62  }
    63  
    64  func (c *Configuration) AddDefaultHeader(key string, value string) {
    65  	c.DefaultHeader[key] = value
    66  }