// NewMockClient returns a new Digital Ocean API client mock.
179808
func NewMockClient() *MockClient {
	client, _ := NewClient(&Option{APIKey: "test"})

	mux := http.NewServeMux()
	server := httptest.NewServer(mux)
	url, _ := url.Parse(server.URL)
	client.BaseURL = url

	cli := &MockClient{Mux: mux,
		Server:      server,
		Client:      client,
		FixturesDir: "./test-fixtures"}

	return cli
}
1322279
func NewMockServiceAPIClient(ctrl *gomock.Controller) *MockServiceAPIClient {
	mock := &MockServiceAPIClient{ctrl: ctrl}
	mock.recorder = &MockServiceAPIClientMockRecorder{mock}
	return mock
}
1220282
func NewMockServer() MockServer {
	ms := MockServer{}

	// Add all our handlers
	r := chi.NewRouter()

	r.Route("/v3", func(r chi.Router) {
		ms.addIPRoutes(r)
		ms.addExportRoutes(r)
		ms.addDomainRoutes(r)
		ms.addMailingListRoutes(r)
		ms.addEventRoutes(r)
		ms.addMessagesRoutes(r)
		ms.addValidationRoutes(r)
		ms.addRoutes(r)
	})

	// Start the server
	ms.srv = httptest.NewServer(r)
	return ms
}
895541
func NewClient(clientConfig ClientConfig) *Client {
	client := &Client{
		ClientConfig: clientConfig,
	}

	// If reader is nil use default rand.Reader
	if clientConfig.Reader == nil {
		client.Reader = rand.Reader
	}

	// If hash is nil use default sha256
	if clientConfig.Hash == nil {
		client.Hash = sha256.New()
	}

	return client
}
594008
func NewMockNodeAPIClient(ctrl *gomock.Controller) *MockNodeAPIClient {
	mock := &MockNodeAPIClient{ctrl: ctrl}
	mock.recorder = &MockNodeAPIClientMockRecorder{mock}
	return mock
}
940032
func NewMockPitayaClient(ctrl *gomock.Controller) *MockPitayaClient {
	mock := &MockPitayaClient{ctrl: ctrl}
	mock.recorder = &MockPitayaClientMockRecorder{mock}
	return mock
}
27100
func NewMockServer(ctrl *gomock.Controller) *MockServer {
	mock := &MockServer{ctrl: ctrl}
	mock.recorder = &MockServerMockRecorder{mock}
	return mock
}
901300
func NewMockProvisionerClient(ctrl *gomock.Controller) *MockProvisionerClient {
	mock := &MockProvisionerClient{ctrl: ctrl}
	mock.recorder = &MockProvisionerClientMockRecorder{mock}
	return mock
}
4909
func NewClient(params ClientParams) Client {
	return newClient(params.ServiceName, params.ClientConfig, params.Options...)
}
160067
func NewMock(opts ...ConnectOpts) *Mock {
	m := &Mock{
		ExpectedQueries: make([]*MockQuery, 0),
		Queries:         make([]MockQuery, 0),
	}

	if len(opts) > 0 {
		m.opts = opts[0]
	}

	return m
}
1141643
func NewClient(apiKey string) *Client {
	c := &Client{
		URL:        BaseURL,
		key:        apiKey,
		post:       http.PostForm,
		argMarshal: marshallArgs,
	}
	c.apiCall = c.liveAPICaller
	return c
}
567370
func NewClient(addrStr string, opts ...ClientParam) (*Client, error) {
	n, err := crand.Int(crand.Reader, big.NewInt(math.MaxInt64))
	if err != nil {
		return nil, err
	}
	rand.Seed(n.Int64())

	addr, err := protocol.ResolveAddr(addrStr)
	if err != nil {
		return nil, err
	}
	cl := &Client{}
	cl.backendParams = &backendParams{}
	cl.backendParams.addr = addr
	cl.cap = DefaultCapacity
	cl.nBackends = DefaultParallelism
	for _, opt := range opts {
		if err = opt(cl); err != nil {
			return nil, err
		}
	}
	ch := make(chan *recordOp, cl.cap)
	cl.records = ch

	var ctx context.Context
	ctx, cl.cancel = context.WithCancel(context.Background())

	fb := []flushNotifier{}
	for i := uint(0); i < cl.nBackends; i++ {
		switch addr := addr.(type) {
		case *net.UDPAddr:
			be := &packetBackend{backendParams: *cl.backendParams}
			fb = append(fb, newFlushNofifier(be))
		case *net.UnixAddr:
			be := &streamBackend{backendParams: *cl.backendParams}
			fb = append(fb, newFlushNofifier(be))
		default:
			return nil, fmt.Errorf("can not connect to %v addresses", addr.Network())
		}
	}
	cl.flushBackends = fb
	cl.run(ctx)

	return cl, nil
}
1189064
func NewClient(credentials Credentials, debug bool) (*Client, error) {
	credentials.init()
	client := &Client{
		Credentials: credentials,
		debug:       debug,
	}

	return client, nil
}
817694
func NewMockInstance(ctrl *gomock.Controller) *MockInstance {
	mock := &MockInstance{ctrl: ctrl}
	mock.recorder = &MockInstanceMockRecorder{mock}
	return mock
}
803554
func NewMockCAClient(orgName string, cryptoProvider core.CryptoSuite) (api.CAClient, error) {
	mcm := MockCAClient{}
	return &mcm, nil
}
1126099
func NewClient() (*Client, error) {
	cc := ClientConfig{
		ChunkSize:   1420,
		Compression: COMP_GZIP,
	}
	return NewClientWithConfig(cc)
}
1340280
func NewClient(conn net.Conn, host string) (*Client, error) {
	text := textproto.NewConn(conn)
	line, err := text.ReadLine()
	if err != nil {
		text.Close()
		return nil, err
	}
	if !strings.Contains(line, "ustack") {
		text.Close()
		return nil, fmt.Errorf("Not a ustackd server")
	}
	return &Client{Text: text, conn: conn, host: host}, nil
}