<commit_before>package glacier

import (
	"bytes"
	"encoding/json"
	"github.com/rdwilliamson/aws"
	"io/ioutil"
	"net/http"
)

type job struct {
	Type        string
	ArchiveId   string `json:",omitempty"` // archive retrieval only
	Description string
	Format      string `json:",omitempty"` // inventory retrieval only
	SNSTopic    string
}

func (c *Connection) InitiateRetrievalJob(vault, archive, topic string) error {
	return nil
}

func (c *Connection) InitiateInventoryJob(vault, description,
	topic string) error {
	j := job{Type: "inventory-retrieval", Description: description,
		SNSTopic: topic}
	rawBody, err := json.Marshal(j)
	if err != nil {
		return err
	}
	body := bytes.NewReader(rawBody)

	request, err := http.NewRequest("POST",
		"https://"+c.Signature.Region.Glacier+"/-/vaults/"+vault+"/jobs", body)
	if err != nil {
		return err
	}
	request.Header.Add("x-amz-glacier-version", "2012-06-01")

	err = c.Signature.Sign(request, body, nil)
	if err != nil {
		return err
	}

	response, err := c.Client.Do(request)
	if err != nil {
		return err
	}

	if response.StatusCode != 202 {
		body, err := ioutil.ReadAll(response.Body)
		if err != nil {
			return err
		}
		err = response.Body.Close()
		if err != nil {
			return err
		}
		var e aws.Error
		err = json.Unmarshal(body, &e)
		if err != nil {
			return err
		}
		return e
	}

	return nil
}

func (c *Connection) DescribeJob() error {
	return nil
}

func (c *Connection) GetRetrievalJob(vault, job string, start, end uint) error {
	return nil
}

func (c *Connection) GetInventoryJob(vault, job string) error {
	return nil<commit_msg>Added returning of job ID from inventory listing.<commit_after>package glacier

import (
	"bytes"
	"encoding/json"
	"github.com/rdwilliamson/aws"
	"io/ioutil"
	"net/http"
)

type job struct {
	Type        string
	ArchiveId   string `json:",omitempty"` // archive retrieval only
	Description string
	Format      string `json:",omitempty"` // inventory retrieval only
	SNSTopic    string
}

func (c *Connection) InitiateRetrievalJob(vault, archive, topic string) error {
	return nil
}

func (c *Connection) InitiateInventoryJob(vault, description,
	topic string) (string, error) {
	j := job{Type: "inventory-retrieval", Description: description,
		SNSTopic: topic}
	rawBody, err := json.Marshal(j)
	if err != nil {
		return "", err
	}
	body := bytes.NewReader(rawBody)

	request, err := http.NewRequest("POST",
		"https://"+c.Signature.Region.Glacier+"/-/vaults/"+vault+"/jobs", body)
	if err != nil {
		return "", err
	}
	request.Header.Add("x-amz-glacier-version", "2012-06-01")

	err = c.Signature.Sign(request, body, nil)
	if err != nil {
		return "", err
	}

	response, err := c.Client.Do(request)
	if err != nil {
		return "", err
	}

	if response.StatusCode != 202 {
		body, err := ioutil.ReadAll(response.Body)
		if err != nil {
			return "", err
		}
		err = response.Body.Close()
		if err != nil {
			return "", err
		}
		var e aws.Error
		err = json.Unmarshal(body, &e)
		if err != nil {
			return "", err
		}
		return "", e
	}

	return response.Header.Get("x-amz-job-id"), nil
}

func (c *Connection) DescribeJob() error {
	return nil
}

func (c *Connection) GetRetrievalJob(vault, job string, start, end uint) error {
	return nil
}

func (c *Connection) GetInventoryJob(vault, job string) error {
	return nil
{'fraction_non_alphanumeric': 0.14092140921409213, 'fraction_numerical': 0.00662451068955134, 'mean_word_length': 3.613888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '178872', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1172, 'n_words': 316}