Example #1
0
func mantaFactory(conf map[string]string) (Client, error) {
	path, ok := conf["path"]
	if !ok {
		return nil, fmt.Errorf("missing 'path' configuration")
	}

	objectName, ok := conf["objectName"]
	if !ok {
		objectName = DEFAULT_OBJECT_NAME
	}

	creds, err := getCredentialsFromEnvironment()

	if err != nil {
		return nil, fmt.Errorf("Error getting Manta credentials: %s", err.Error())
	}

	client := manta.New(joyentclient.NewClient(
		creds.MantaEndpoint.URL,
		"",
		creds,
		log.New(os.Stderr, "", log.LstdFlags),
	))

	return &MantaClient{
		Client:     client,
		Path:       path,
		ObjectName: objectName,
	}, nil
}
Example #2
0
func newStorage(cfg *environConfig, name string) (storage.Storage, error) {
	creds, err := credentials(cfg)
	if err != nil {
		return nil, err
	}
	client := client.NewClient(cfg.mantaUrl(), "", creds, &logger)

	if name == "" {
		name = cfg.controlDir()
	}

	return &JoyentStorage{
		ecfg:          cfg,
		containerName: name,
		manta:         manta.New(client)}, nil
}
Example #3
0
func (s *LiveTests) SetUpTest(c *gc.C) {
	client := client.NewClient(s.creds.MantaEndpoint.URL, "", s.creds, log.New(os.Stderr, "", log.LstdFlags))
	c.Assert(client, gc.NotNil)
	s.testClient = manta.New(client)
	c.Assert(s.testClient, gc.NotNil)
}
Example #4
0
func (s *LocalTests) SetUpTest(c *gc.C) {
	client := client.NewClient(s.creds.MantaEndpoint.URL, "", s.creds, &manta.Logger)
	c.Assert(client, gc.NotNil)
	s.testClient = manta.New(client)
	c.Assert(s.testClient, gc.NotNil)
}