1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Close #204. Add Trello dependency to /vendor

This commit is contained in:
Chris Cummer 2018-06-19 12:40:27 -07:00
parent 3aec59b150
commit 16d56bb0d8
73 changed files with 23988 additions and 853 deletions

35
Gopkg.lock generated
View File

@ -7,11 +7,17 @@
revision = "0fd7230b2a7505833d5f69b75cbd6c9582401479"
version = "v0.23.0"
[[projects]]
branch = "master"
name = "github.com/adlio/trello"
packages = ["."]
revision = "05dcd358e32866f2353c4f49077346a0eb585436"
[[projects]]
branch = "master"
name = "github.com/briandowns/openweathermap"
packages = ["."]
revision = "2adae1e5d10290d8cd435bd30296fc5e8f754862"
revision = "6a9abf92e34f4de62ac671caee3143f10b98892d"
[[projects]]
branch = "master"
@ -44,7 +50,7 @@
branch = "master"
name = "github.com/google/go-github"
packages = ["github"]
revision = "2ae5df7848328c214a48cec94c7d410cf8526527"
revision = "a83ae98ad5d09188c49d6056edb60ec9bdf202bd"
[[projects]]
branch = "master"
@ -76,6 +82,12 @@
packages = ["."]
revision = "9a10d05a33a8b9e828f20491e21e8927dec35f72"
[[projects]]
name = "github.com/pkg/errors"
packages = ["."]
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
version = "v0.8.0"
[[projects]]
name = "github.com/radovskyb/watcher"
packages = ["."]
@ -86,13 +98,13 @@
branch = "master"
name = "github.com/rivo/tview"
packages = ["."]
revision = "71ecf1f4299c6d72b16d20da72405b7e85ac8720"
revision = "e643d10b365df4caec5ed32e4c1103e185af9079"
[[projects]]
branch = "master"
name = "github.com/xanzy/go-gitlab"
packages = ["."]
revision = "73e9df58a3194b1256edae4d2e819603f06d428c"
revision = "1c1cfedc5a8ffe122b1981e8b0822fe22f461643"
[[projects]]
branch = "master"
@ -107,7 +119,7 @@
"context",
"context/ctxhttp"
]
revision = "1e491301e022f8f977054da4c2d852decd59571f"
revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196"
[[projects]]
branch = "master"
@ -119,7 +131,7 @@
"jws",
"jwt"
]
revision = "1e0a3fa8ba9a5c9eb35c271780101fdaf1b205d7"
revision = "113ce6928c4638e14fd5eba69b9e6ec899d5dd83"
[[projects]]
name = "golang.org/x/text"
@ -140,9 +152,10 @@
"calendar/v3",
"gensupport",
"googleapi",
"googleapi/internal/uritemplates"
"googleapi/internal/uritemplates",
"sheets/v4"
]
revision = "00e3bb8d04691e25ee2fccf98c866bcb7925c3ec"
revision = "2eea9ba0a3d94f6ab46508083e299a00bbbc65f6"
[[projects]]
name = "google.golang.org/appengine"
@ -158,8 +171,8 @@
"internal/urlfetch",
"urlfetch"
]
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
version = "v1.0.0"
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
version = "v1.1.0"
[[projects]]
name = "gopkg.in/yaml.v2"
@ -170,6 +183,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "fd122eb7175ffd7db7cb197de13e0b850231ec9269a63a8ca9d117a8aa50d7e5"
inputs-digest = "05d3df164ca80efbb1d5cf00a06e7ffde102690f0fabafb7d4e9860e461832db"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -77,6 +77,10 @@
name = "gopkg.in/yaml.v2"
version = "2.2.1"
[[constraint]]
branch = "master"
name = "github.com/adlio/trello"
[prune]
go-tests = true
unused-packages = true

28
vendor/github.com/adlio/trello/.gitignore generated vendored Normal file
View File

@ -0,0 +1,28 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
coverage.sh
coverage.out
coverage.html

11
vendor/github.com/adlio/trello/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,11 @@
language: go
sudo: false
go:
- 1.7
- 1.8
- tip
before_install:
- go get github.com/mattn/goveralls
script:
- $HOME/gopath/bin/goveralls -service=travis-ci

21
vendor/github.com/adlio/trello/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Aaron Longwell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

232
vendor/github.com/adlio/trello/README.md generated vendored Normal file
View File

@ -0,0 +1,232 @@
Go Trello API
================
[![Trello Logo](https://raw.githubusercontent.com/adlio/trello/master/trello-logo.png)](https://www.trello.com)
[![GoDoc](https://godoc.org/github.com/adlio/trello?status.svg)](http://godoc.org/github.com/adlio/trello)
[![Build Status](https://travis-ci.org/adlio/trello.svg)](https://travis-ci.org/adlio/trello)
[![Coverage Status](https://coveralls.io/repos/github/adlio/trello/badge.svg?branch=master)](https://coveralls.io/github/adlio/trello?branch=master)
A #golang package to access the [Trello API](https://developers.trello.com/v1.0/reference). Nearly 100% of the
read-only surface area of the API is covered, as is creation and modification of Cards.
Low-level infrastructure for features to modify Lists and Boards are easy to add... just not
done yet.
Pull requests are welcome for missing features.
My current development focus is documentation, especially enhancing this README.md with more
example use cases.
## Installation
The Go Trello API has been Tested compatible with Go 1.7 on up. Its only dependency is
the `github.com/pkg/errors` package. It otherwise relies only on the Go standard library.
```
go get github.com/adlio/trello
```
## Basic Usage
All interaction starts with a `trello.Client`. Create one with your appKey and token:
```Go
client := trello.NewClient(appKey, token)
```
All API requests accept a trello.Arguments object. This object is a simple
`map[string]string`, converted to query string arguments in the API call.
Trello has sane defaults on API calls. We have a `trello.Defaults()` utility function
which can be used when you desire the default Trello arguments. Internally,
`trello.Defaults()` is an empty map, which translates to an empty query string.
```Go
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
```
## Client Longevity
When getting Lists from Boards or Cards from Lists, the original `trello.Client` pointer
is carried along in returned child objects. It's important to realize that this enables
you to make additional API calls via functions invoked on the objects you receive:
```Go
client := trello.NewClient(appKey, token)
board, err := client.GetBoard("ID", trello.Defaults())
// GetLists makes an API call to /boards/:id/lists using credentials from `client`
lists, err := board.GetLists(trello.Defaults())
for _, list := range lists {
// GetCards makes an API call to /lists/:id/cards using credentials from `client`
cards, err := list.GetCards(trello.Defaults())
}
```
## Get Trello Boards for a User
Boards can be retrieved directly by their ID (see example above), or by asking
for all boards for a member:
```Go
member, err := client.GetMember("usernameOrId", trello.Defaults())
if err != nil {
// Handle error
}
boards, err := member.GetBoards(trello.Defaults())
if err != nil {
// Handle error
}
```
## Get Trello Lists on a Board
```Go
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
lists, err := board.GetLists(trello.Defaults())
if err != nil {
// Handle error
}
```
## Get Trello Cards on a Board
```Go
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
cards, err := board.GetCards(trello.Defaults())
if err != nil {
// Handle error
}
```
## Get Trello Cards on a List
```Go
list, err := client.GetList("lIsTID", trello.Defaults())
if err != nil {
// Handle error
}
cards, err := list.GetCards(trello.Defaults())
if err != nil {
// Handle error
}
```
## Creating a Card
The API provides several mechanisms for creating new cards.
### Creating Cards from Scratch on the Client
This approach requires the most input data on the card:
```Go
card := trello.Card{
Name: "Card Name",
Desc: "Card description",
Pos: 12345.678,
IDList: "iDOfaLiSt",
IDLabels: []string{"labelID1", "labelID2"},
}
err := client.CreateCard(card, trello.Defaults())
```
### Creating Cards On a List
```Go
list, err := client.GetList("lIsTID", trello.Defaults())
list.AddCard(trello.Card{ Name: "Card Name", Description: "Card description" }, trello.Defaults())
```
### Creating a Card by Copying Another Card
```Go
err := card.CopyToList("listIdNUmber", trello.Defaults())
```
## Get Actions on a Board
```Go
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
actions, err := board.GetActions(trello.Defaults())
if err != nil {
// Handle error
}
```
## Get Actions on a Card
```Go
card, err := client.GetCard("cArDID", trello.Defaults())
if err != nil {
// Handle error
}
actions, err := card.GetActions(trello.Defaults())
if err != nil {
// Handle error
}
```
## Rearrange Cards Within a List
```Go
err := card.MoveToTopOfList()
err = card.MoveToBottomOfList()
err = card.SetPos(12345.6789)
```
## Moving a Card to Another List
```Go
err := card.MoveToList("listIdNUmber", trello.Defaults())
```
## Card Ancestry
Trello provides ancestry tracking when cards are created as copies of other cards. This package
provides functions for working with this data:
```Go
// ancestors will hold a slice of *trello.Cards, with the first
// being the card's parent, and the last being parent's parent's parent...
ancestors, err := card.GetAncestorCards(trello.Defaults())
// GetOriginatingCard() is an alias for the last element in the slice
// of ancestor cards.
ultimateParentCard, err := card.GetOriginatingCard(trello.Defaults())
```
## Debug Logging
If you'd like to see all API calls logged, you can attach a `.Logger` (implementing `Debugf(string, ...interface{})`)
to your client. The interface for the logger mimics logrus. Example usage:
```Go
logger := logrus.New()
logger.SetLevel(logrus.DebugLevel)
client := trello.NewClient(appKey, token)
client.Logger = logger
```

5
vendor/github.com/adlio/trello/TODO.txt generated vendored Normal file
View File

@ -0,0 +1,5 @@
- Create List
- Delete Card
- Archive Card
- Reorder Cards in List

57
vendor/github.com/adlio/trello/action-collection.go generated vendored Normal file
View File

@ -0,0 +1,57 @@
package trello
import (
"sort"
)
// ActionCollection is an alias of []*Action, which sorts by the Action's ID.
// Which is the same as sorting by the Action's time of occurrence
type ActionCollection []*Action
func (c ActionCollection) Len() int { return len(c) }
func (c ActionCollection) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c ActionCollection) Less(i, j int) bool { return c[i].ID < c[j].ID }
func (actions ActionCollection) FirstCardCreateAction() *Action {
sort.Sort(actions)
for _, action := range actions {
if action.DidCreateCard() {
return action
}
}
return nil
}
func (actions ActionCollection) ContainsCardCreation() bool {
return actions.FirstCardCreateAction() != nil
}
func (c ActionCollection) FilterToCardCreationActions() ActionCollection {
newSlice := make(ActionCollection, 0, len(c))
for _, action := range c {
if action.DidCreateCard() {
newSlice = append(newSlice, action)
}
}
return newSlice
}
func (c ActionCollection) FilterToListChangeActions() ActionCollection {
newSlice := make(ActionCollection, 0, len(c))
for _, action := range c {
if action.DidChangeListForCard() {
newSlice = append(newSlice, action)
}
}
return newSlice
}
func (c ActionCollection) FilterToCardMembershipChangeActions() ActionCollection {
newSlice := make(ActionCollection, 0, len(c))
for _, action := range c {
if action.DidChangeCardMembership() || action.DidArchiveCard() || action.DidUnarchiveCard() {
newSlice = append(newSlice, action)
}
}
return newSlice
}

148
vendor/github.com/adlio/trello/action.go generated vendored Normal file
View File

@ -0,0 +1,148 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
"time"
)
type Action struct {
ID string `json:"id"`
IDMemberCreator string `json:"idMemberCreator"`
Type string `json:"type"`
Date time.Time `json:"date"`
Data *ActionData `json:"data,omitempty"`
MemberCreator *Member `json:"memberCreator,omitempty"`
Member *Member `json:"member,omitempty"`
}
type ActionData struct {
Text string `json:"text,omitempty"`
List *List `json:"list,omitempty"`
Card *Card `json:"card,omitempty"`
CardSource *Card `json:"cardSource,omitempty"`
Board *Board `json:"board,omitempty"`
Old *Card `json:"old,omitempty"`
ListBefore *List `json:"listBefore,omitempty"`
ListAfter *List `json:"listAfter,omitempty"`
DateLastEdited time.Time `json:"dateLastEdited"`
CheckItem *CheckItem `json:"checkItem"`
Checklist *Checklist `json:"checklist"`
}
func (b *Board) GetActions(args Arguments) (actions ActionCollection, err error) {
path := fmt.Sprintf("boards/%s/actions", b.ID)
err = b.client.Get(path, args, &actions)
return
}
func (l *List) GetActions(args Arguments) (actions ActionCollection, err error) {
path := fmt.Sprintf("lists/%s/actions", l.ID)
err = l.client.Get(path, args, &actions)
return
}
func (c *Card) GetActions(args Arguments) (actions ActionCollection, err error) {
path := fmt.Sprintf("cards/%s/actions", c.ID)
err = c.client.Get(path, args, &actions)
return
}
// GetListChangeActions retrieves a slice of Actions which resulted in changes
// to the card's active List. This includes the createCard and copyCard action (which
// place the card in its first list, and the updateCard:closed action, which remove it
// from its last list.
//
// This function is just an alias for:
// card.GetActions(Arguments{"filter": "createCard,copyCard,updateCard:idList,updateCard:closed", "limit": "1000"})
//
func (c *Card) GetListChangeActions() (actions ActionCollection, err error) {
return c.GetActions(Arguments{"filter": "createCard,copyCard,updateCard:idList,updateCard:closed"})
}
func (c *Card) GetMembershipChangeActions() (actions ActionCollection, err error) {
// We include updateCard:closed as if the member is implicitly removed from the card when it's closed.
// This allows us to "close out" the duration length.
return c.GetActions(Arguments{"filter": "addMemberToCard,removeMemberFromCard,updateCard:closed"})
}
// DidCreateCard() returns true if this action created a card, false otherwise.
func (a *Action) DidCreateCard() bool {
switch a.Type {
case "createCard", "emailCard", "copyCard", "convertToCardFromCheckItem":
return true
case "moveCardToBoard":
return true // Unsure about this one
default:
return false
}
}
func (a *Action) DidArchiveCard() bool {
return (a.Type == "updateCard") && a.Data != nil && a.Data.Card != nil && a.Data.Card.Closed
}
func (a *Action) DidUnarchiveCard() bool {
return (a.Type == "updateCard") && a.Data != nil && a.Data.Old != nil && a.Data.Old.Closed
}
// Returns true if this action created the card (in which case it caused it to enter its
// first list), archived the card (in which case it caused it to leave its last List),
// or was an updateCard action involving a change to the list. This is supporting
// functionality for ListDuration.
//
func (a *Action) DidChangeListForCard() bool {
if a.DidCreateCard() {
return true
}
if a.DidArchiveCard() {
return true
}
if a.DidUnarchiveCard() {
return true
}
if a.Type == "updateCard" {
if a.Data != nil && a.Data.ListAfter != nil {
return true
}
}
return false
}
func (a *Action) DidChangeCardMembership() bool {
switch a.Type {
case "addMemberToCard":
return true
case "removeMemberFromCard":
return true
default:
return false
}
}
// ListAfterAction calculates which List the card ended up in after this action
// completed. Returns nil when the action resulted in the card being archived (in
// which case we consider it to not be in a list anymore), or when the action isn't
// related to a list at all (in which case this is a nonsensical question to ask).
//
func ListAfterAction(a *Action) *List {
switch a.Type {
case "createCard", "copyCard", "emailCard", "convertToCardFromCheckItem":
return a.Data.List
case "updateCard":
if a.DidArchiveCard() {
return nil
} else if a.DidUnarchiveCard() {
return a.Data.List
}
if a.Data.ListAfter != nil {
return a.Data.ListAfter
}
}
return nil
}

24
vendor/github.com/adlio/trello/arguments.go generated vendored Normal file
View File

@ -0,0 +1,24 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"net/url"
)
type Arguments map[string]string
func Defaults() Arguments {
return make(Arguments)
}
func (args Arguments) ToURLValues() url.Values {
v := url.Values{}
for key, value := range args {
v.Set(key, value)
}
return v
}

29
vendor/github.com/adlio/trello/attachment.go generated vendored Normal file
View File

@ -0,0 +1,29 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
type Attachment struct {
ID string `json:"id"`
Name string `json:"name"`
Pos float32 `json:"pos"`
Bytes int `json:"int"`
Date string `json:"date"`
EdgeColor string `json:"edgeColor"`
IDMember string `json:"idMember"`
IsUpload bool `json:"isUpload"`
MimeType string `json:"mimeType"`
Previews []AttachmentPreview `json:"previews"`
URL string `json:"url"`
}
type AttachmentPreview struct {
ID string `json:"_id"`
URL string `json:"url"`
Width int `json:"width"`
Height int `json:"height"`
Bytes int `json:"bytes"`
Scaled bool `json:"scaled"`
}

89
vendor/github.com/adlio/trello/board.go generated vendored Normal file
View File

@ -0,0 +1,89 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
"time"
)
type Board struct {
client *Client
ID string `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
Closed bool `json:"closed"`
IdOrganization string `json:"idOrganization"`
Pinned bool `json:"pinned"`
Url string `json:"url"`
ShortUrl string `json:"shortUrl"`
Prefs struct {
PermissionLevel string `json:"permissionLevel"`
Voting string `json:"voting"`
Comments string `json:"comments"`
Invitations string `json:"invitations"`
SelfJoin bool `json:"selfjoin"`
CardCovers bool `json:"cardCovers"`
CardAging string `json:"cardAging"`
CalendarFeedEnabled bool `json:"calendarFeedEnabled"`
Background string `json:"background"`
BackgroundColor string `json:"backgroundColor"`
BackgroundImage string `json:"backgroundImage"`
BackgroundImageScaled []BackgroundImage `json:"backgroundImageScaled"`
BackgroundTile bool `json:"backgroundTile"`
BackgroundBrightness string `json:"backgroundBrightness"`
CanBePublic bool `json:"canBePublic"`
CanBeOrg bool `json:"canBeOrg"`
CanBePrivate bool `json:"canBePrivate"`
CanInvite bool `json:"canInvite"`
} `json:"prefs"`
LabelNames struct {
Black string `json:"black,omitempty"`
Blue string `json:"blue,omitempty"`
Green string `json:"green,omitempty"`
Lime string `json:"lime,omitempty"`
Orange string `json:"orange,omitempty"`
Pink string `json:"pink,omitempty"`
Purple string `json:"purple,omitempty"`
Red string `json:"red,omitempty"`
Sky string `json:"sky,omitempty"`
Yellow string `json:"yellow,omitempty"`
} `json:"labelNames"`
Lists []*List `json:"lists"`
Actions []*Action `json:"actions"`
}
type BackgroundImage struct {
Width int `json:"width"`
Height int `json:"height"`
URL string `json:"url"`
}
func (b *Board) CreatedAt() time.Time {
t, _ := IDToTime(b.ID)
return t
}
/**
* Board retrieves a Trello board by its ID.
*/
func (c *Client) GetBoard(boardID string, args Arguments) (board *Board, err error) {
path := fmt.Sprintf("boards/%s", boardID)
err = c.Get(path, args, &board)
if board != nil {
board.client = c
}
return
}
func (m *Member) GetBoards(args Arguments) (boards []*Board, err error) {
path := fmt.Sprintf("members/%s/boards", m.ID)
err = m.client.Get(path, args, &boards)
for i := range boards {
boards[i].client = m.client
}
return
}

388
vendor/github.com/adlio/trello/card.go generated vendored Normal file
View File

@ -0,0 +1,388 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
)
type Card struct {
client *Client
// Key metadata
ID string `json:"id"`
IDShort int `json:"idShort"`
Name string `json:"name"`
Pos float64 `json:"pos"`
Email string `json:"email"`
ShortLink string `json:"shortLink"`
ShortUrl string `json:"shortUrl"`
Url string `json:"url"`
Desc string `json:"desc"`
Due *time.Time `json:"due"`
DueComplete bool `json:"dueComplete"`
Closed bool `json:"closed"`
Subscribed bool `json:"subscribed"`
DateLastActivity *time.Time `json:"dateLastActivity"`
// Board
Board *Board
IDBoard string `json:"idBoard"`
// List
List *List
IDList string `json:"idList"`
// Badges
Badges struct {
Votes int `json:"votes"`
ViewingMemberVoted bool `json:"viewingMemberVoted"`
Subscribed bool `json:"subscribed"`
Fogbugz string `json:"fogbugz,omitempty"`
CheckItems int `json:"checkItems"`
CheckItemsChecked int `json:"checkItemsChecked"`
Comments int `json:"comments"`
Attachments int `json:"attachments"`
Description bool `json:"description"`
Due *time.Time `json:"due,omitempty"`
} `json:"badges"`
// Actions
Actions ActionCollection `json:"actions,omitempty"`
// Checklists
IDCheckLists []string `json:"idCheckLists"`
Checklists []*Checklist `json:"checklists,omitempty"`
CheckItemStates []*CheckItemState `json:"checkItemStates,omitempty"`
// Members
IDMembers []string `json:"idMembers,omitempty"`
IDMembersVoted []string `json:"idMembersVoted,omitempty"`
Members []*Member `json:"members,omitempty"`
// Attachments
IDAttachmentCover string `json:"idAttachmentCover"`
ManualCoverAttachment bool `json:"manualCoverAttachment"`
Attachments []*Attachment `json:"attachments,omitempty"`
// Labels
IDLabels []string `json:"idLabels,omitempty"`
Labels []*Label `json:"labels,omitempty"`
}
func (c *Card) CreatedAt() time.Time {
t, _ := IDToTime(c.ID)
return t
}
func (c *Card) MoveToList(listID string, args Arguments) error {
path := fmt.Sprintf("cards/%s", c.ID)
args["idList"] = listID
return c.client.Put(path, args, &c)
}
func (c *Card) SetPos(newPos float64) error {
path := fmt.Sprintf("cards/%s", c.ID)
return c.client.Put(path, Arguments{"pos": fmt.Sprintf("%f", newPos)}, c)
}
func (c *Card) RemoveMember(memberID string) error {
path := fmt.Sprintf("cards/%s/idMembers/%s", c.ID, memberID)
return c.client.Delete(path, Defaults(), nil)
}
func (c *Card) AddMemberID(memberID string) (member []*Member, err error) {
path := fmt.Sprintf("cards/%s/idMembers", c.ID)
err = c.client.Post(path, Arguments{"value": memberID}, &member)
return member, err
}
func (c *Card) MoveToTopOfList() error {
path := fmt.Sprintf("cards/%s", c.ID)
return c.client.Put(path, Arguments{"pos": "top"}, c)
}
func (c *Card) MoveToBottomOfList() error {
path := fmt.Sprintf("cards/%s", c.ID)
return c.client.Put(path, Arguments{"pos": "bottom"}, c)
}
func (c *Card) Update(args Arguments) error {
path := fmt.Sprintf("cards/%s", c.ID)
return c.client.Put(path, args, c)
}
func (c *Client) CreateCard(card *Card, extraArgs Arguments) error {
path := "cards"
args := Arguments{
"name": card.Name,
"desc": card.Desc,
"pos": strconv.FormatFloat(card.Pos, 'g', -1, 64),
"idList": card.IDList,
"idMembers": strings.Join(card.IDMembers, ","),
"idLabels": strings.Join(card.IDLabels, ","),
}
if card.Due != nil {
args["due"] = card.Due.Format(time.RFC3339)
}
// Allow overriding the creation position with 'top' or 'botttom'
if pos, ok := extraArgs["pos"]; ok {
args["pos"] = pos
}
err := c.Post(path, args, &card)
if err == nil {
card.client = c
}
return err
}
func (l *List) AddCard(card *Card, extraArgs Arguments) error {
path := fmt.Sprintf("lists/%s/cards", l.ID)
args := Arguments{
"name": card.Name,
"desc": card.Desc,
"idMembers": strings.Join(card.IDMembers, ","),
"idLabels": strings.Join(card.IDLabels, ","),
}
if card.Due != nil {
args["due"] = card.Due.Format(time.RFC3339)
}
// Allow overwriting the creation position with 'top' or 'bottom'
if pos, ok := extraArgs["pos"]; ok {
args["pos"] = pos
}
err := l.client.Post(path, args, &card)
if err == nil {
card.client = l.client
} else {
err = errors.Wrapf(err, "Error adding card to list %s", l.ID)
}
return err
}
// Try these Arguments
//
// Arguments["keepFromSource"] = "all"
// Arguments["keepFromSource"] = "none"
// Arguments["keepFromSource"] = "attachments,checklists,comments"
//
func (c *Card) CopyToList(listID string, args Arguments) (*Card, error) {
path := "cards"
args["idList"] = listID
args["idCardSource"] = c.ID
newCard := Card{}
err := c.client.Post(path, args, &newCard)
if err == nil {
newCard.client = c.client
} else {
err = errors.Wrapf(err, "Error copying card '%s' to list '%s'.", c.ID, listID)
}
return &newCard, err
}
func (c *Card) AddComment(comment string, args Arguments) (*Action, error) {
path := fmt.Sprintf("cards/%s/actions/comments", c.ID)
args["text"] = comment
action := Action{}
err := c.client.Post(path, args, &action)
if err != nil {
err = errors.Wrapf(err, "Error commenting on card %s", c.ID)
}
return &action, err
}
// If this Card was created from a copy of another Card, this func retrieves
// the originating Card. Returns an error only when a low-level failure occurred.
// If this Card has no parent, a nil card and nil error are returned. In other words, the
// non-existence of a parent is not treated as an error.
//
func (c *Card) GetParentCard(args Arguments) (*Card, error) {
// Hopefully the card came pre-loaded with Actions including the card creation
action := c.Actions.FirstCardCreateAction()
if action == nil {
// No luck. Go get copyCard actions for this card.
c.client.log("Creation action wasn't supplied before GetParentCard() on '%s'. Getting copyCard actions.", c.ID)
actions, err := c.GetActions(Arguments{"filter": "copyCard"})
if err != nil {
err = errors.Wrapf(err, "GetParentCard() failed to GetActions() for card '%s'", c.ID)
return nil, err
}
action = actions.FirstCardCreateAction()
}
if action != nil && action.Data != nil && action.Data.CardSource != nil {
card, err := c.client.GetCard(action.Data.CardSource.ID, args)
return card, err
}
return nil, nil
}
func (c *Card) GetAncestorCards(args Arguments) (ancestors []*Card, err error) {
// Get the first parent
parent, err := c.GetParentCard(args)
if IsNotFound(err) || IsPermissionDenied(err) {
c.client.log("[trello] Can't get details about the parent of card '%s' due to lack of permissions or card deleted.", c.ID)
return ancestors, nil
}
for parent != nil {
ancestors = append(ancestors, parent)
parent, err = parent.GetParentCard(args)
if IsNotFound(err) || IsPermissionDenied(err) {
c.client.log("[trello] Can't get details about the parent of card '%s' due to lack of permissions or card deleted.", c.ID)
return ancestors, nil
} else if err != nil {
return ancestors, err
}
}
return ancestors, err
}
func (c *Card) GetOriginatingCard(args Arguments) (*Card, error) {
ancestors, err := c.GetAncestorCards(args)
if err != nil {
return c, err
}
if len(ancestors) > 0 {
return ancestors[len(ancestors)-1], nil
} else {
return c, nil
}
}
func (c *Card) CreatorMember() (*Member, error) {
var actions ActionCollection
var err error
if len(c.Actions) == 0 {
c.Actions, err = c.GetActions(Arguments{"filter": "all", "limit": "1000", "memberCreator_fields": "all"})
if err != nil {
err = errors.Wrapf(err, "GetActions() call failed.")
return nil, err
}
}
actions = c.Actions.FilterToCardCreationActions()
if len(actions) > 0 {
return actions[0].MemberCreator, nil
}
return nil, errors.Errorf("No card creation actions on Card %s with a .MemberCreator", c.ID)
}
func (c *Card) CreatorMemberID() (string, error) {
var actions ActionCollection
var err error
if len(c.Actions) == 0 {
c.client.log("[trello] CreatorMemberID() called on card '%s' without any Card.Actions. Fetching fresh.", c.ID)
c.Actions, err = c.GetActions(Defaults())
if err != nil {
err = errors.Wrapf(err, "GetActions() call failed.")
}
}
actions = c.Actions.FilterToCardCreationActions()
if len(actions) > 0 {
if actions[0].IDMemberCreator != "" {
return actions[0].IDMemberCreator, err
}
}
return "", errors.Wrapf(err, "No Actions on card '%s' could be used to find its creator.", c.ID)
}
func (b *Board) ContainsCopyOfCard(cardID string, args Arguments) (bool, error) {
args["filter"] = "copyCard"
actions, err := b.GetActions(args)
if err != nil {
err := errors.Wrapf(err, "GetCards() failed inside ContainsCopyOf() for board '%s' and card '%s'.", b.ID, cardID)
return false, err
}
for _, action := range actions {
if action.Data != nil && action.Data.CardSource != nil && action.Data.CardSource.ID == cardID {
return true, nil
}
}
return false, nil
}
func (c *Client) GetCard(cardID string, args Arguments) (card *Card, err error) {
path := fmt.Sprintf("cards/%s", cardID)
err = c.Get(path, args, &card)
if card != nil {
card.client = c
}
return card, err
}
/**
* Retrieves all Cards on a Board
*
* If before
*/
func (b *Board) GetCards(args Arguments) (cards []*Card, err error) {
path := fmt.Sprintf("boards/%s/cards", b.ID)
err = b.client.Get(path, args, &cards)
// Naive implementation would return here. To make sure we get all
// cards, we begin
if len(cards) > 0 {
moreCards := true
for moreCards == true {
nextCardBatch := make([]*Card, 0)
args["before"] = EarliestCardID(cards)
err = b.client.Get(path, args, &nextCardBatch)
if len(nextCardBatch) > 0 {
cards = append(cards, nextCardBatch...)
} else {
moreCards = false
}
}
}
for i := range cards {
cards[i].client = b.client
}
return
}
/**
* Retrieves all Cards in a List
*/
func (l *List) GetCards(args Arguments) (cards []*Card, err error) {
path := fmt.Sprintf("lists/%s/cards", l.ID)
err = l.client.Get(path, args, &cards)
for i := range cards {
cards[i].client = l.client
}
return
}
func EarliestCardID(cards []*Card) string {
if len(cards) == 0 {
return ""
}
earliest := cards[0].ID
for _, card := range cards {
if card.ID < earliest {
earliest = card.ID
}
}
return earliest
}

30
vendor/github.com/adlio/trello/checklist.go generated vendored Normal file
View File

@ -0,0 +1,30 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
type Checklist struct {
ID string `json:"id"`
Name string `json:"name"`
IDBoard string `json:"idBoard,omitempty"`
IDCard string `json:"idCard,omitempty"`
Pos float64 `json:"pos,omitempty"`
CheckItems []CheckItem `json:"checkItems,omitempty"`
}
type CheckItem struct {
ID string `json:"id"`
Name string `json:"name"`
State string `json:"state"`
IDChecklist string `json:"idChecklist,omitempty"`
Pos float64 `json:"pos,omitempty"`
}
// Manifestation of CheckItem when it appears in CheckItemStates
// on a Card.
type CheckItemState struct {
IDCheckItem string `json:"idCheckItem"`
State string `json:"state"`
}

239
vendor/github.com/adlio/trello/client.go generated vendored Normal file
View File

@ -0,0 +1,239 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/pkg/errors"
)
const DEFAULT_BASEURL = "https://api.trello.com/1"
type Client struct {
Client *http.Client
Logger logger
BaseURL string
Key string
Token string
throttle <-chan time.Time
testMode bool
ctx context.Context
}
type logger interface {
Debugf(string, ...interface{})
}
func NewClient(key, token string) *Client {
return &Client{
Client: http.DefaultClient,
BaseURL: DEFAULT_BASEURL,
Key: key,
Token: token,
throttle: time.Tick(time.Second / 8), // Actually 10/second, but we're extra cautious
testMode: false,
ctx: context.Background(),
}
}
func (c *Client) WithContext(ctx context.Context) *Client {
newC := *c
newC.ctx = ctx
return &newC
}
func (c *Client) Throttle() {
if !c.testMode {
<-c.throttle
}
}
func (c *Client) Get(path string, args Arguments, target interface{}) error {
// Trello prohibits more than 10 seconds/second per token
c.Throttle()
params := args.ToURLValues()
c.log("[trello] GET %s?%s", path, params.Encode())
if c.Key != "" {
params.Set("key", c.Key)
}
if c.Token != "" {
params.Set("token", c.Token)
}
url := fmt.Sprintf("%s/%s", c.BaseURL, path)
urlWithParams := fmt.Sprintf("%s?%s", url, params.Encode())
req, err := http.NewRequest("GET", urlWithParams, nil)
if err != nil {
return errors.Wrapf(err, "Invalid GET request %s", url)
}
req = req.WithContext(c.ctx)
resp, err := c.Client.Do(req)
if err != nil {
return errors.Wrapf(err, "HTTP request failure on %s", url)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return makeHttpClientError(url, resp)
}
decoder := json.NewDecoder(resp.Body)
err = decoder.Decode(target)
if err != nil {
return errors.Wrapf(err, "JSON decode failed on %s", url)
}
return nil
}
func (c *Client) Put(path string, args Arguments, target interface{}) error {
// Trello prohibits more than 10 seconds/second per token
c.Throttle()
params := args.ToURLValues()
c.log("[trello] PUT %s?%s", path, params.Encode())
if c.Key != "" {
params.Set("key", c.Key)
}
if c.Token != "" {
params.Set("token", c.Token)
}
url := fmt.Sprintf("%s/%s", c.BaseURL, path)
urlWithParams := fmt.Sprintf("%s?%s", url, params.Encode())
req, err := http.NewRequest("PUT", urlWithParams, nil)
if err != nil {
return errors.Wrapf(err, "Invalid PUT request %s", url)
}
resp, err := c.Client.Do(req)
if err != nil {
return errors.Wrapf(err, "HTTP request failure on %s", url)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return makeHttpClientError(url, resp)
}
decoder := json.NewDecoder(resp.Body)
err = decoder.Decode(target)
if err != nil {
return errors.Wrapf(err, "JSON decode failed on %s", url)
}
return nil
}
func (c *Client) Post(path string, args Arguments, target interface{}) error {
// Trello prohibits more than 10 seconds/second per token
c.Throttle()
params := args.ToURLValues()
c.log("[trello] POST %s?%s", path, params.Encode())
if c.Key != "" {
params.Set("key", c.Key)
}
if c.Token != "" {
params.Set("token", c.Token)
}
url := fmt.Sprintf("%s/%s", c.BaseURL, path)
urlWithParams := fmt.Sprintf("%s?%s", url, params.Encode())
req, err := http.NewRequest("POST", urlWithParams, nil)
if err != nil {
return errors.Wrapf(err, "Invalid POST request %s", url)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := c.Client.Do(req)
if err != nil {
return errors.Wrapf(err, "HTTP request failure on %s", url)
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return errors.Wrapf(err, "HTTP Read error on response for %s", url)
}
decoder := json.NewDecoder(bytes.NewBuffer(b))
err = decoder.Decode(target)
if err != nil {
return errors.Wrapf(err, "JSON decode failed on %s:\n%s", url, string(b))
}
return nil
}
func (c *Client) Delete(path string, args Arguments, target interface{}) error {
c.Throttle()
params := args.ToURLValues()
c.log("[trello] DELETE %s?%s", path, params.Encode())
if c.Key != "" {
params.Set("key", c.Key)
}
if c.Token != "" {
params.Set("token", c.Token)
}
url := fmt.Sprintf("%s/%s", c.BaseURL, path)
urlWithParams := fmt.Sprintf("%s?%s", url, params.Encode())
req, err := http.NewRequest("DELETE", urlWithParams, nil)
if err != nil {
return errors.Wrapf(err, "Invalid DELETE request %s", url)
}
resp, err := c.Client.Do(req)
if err != nil {
return errors.Wrapf(err, "HTTP request failure on %s", url)
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return errors.Wrapf(err, "HTTP Read error on response for %s", url)
}
decoder := json.NewDecoder(bytes.NewBuffer(b))
err = decoder.Decode(target)
if err != nil {
return errors.Wrapf(err, "JSON decode failed on %s:\n%s", url, string(b))
}
return nil
}
func (c *Client) log(format string, args ...interface{}) {
if c.Logger != nil {
c.Logger.Debugf(format, args)
}
}

55
vendor/github.com/adlio/trello/errors.go generated vendored Normal file
View File

@ -0,0 +1,55 @@
package trello
import (
"fmt"
"io/ioutil"
"net/http"
)
type notFoundError interface {
IsNotFound() bool
}
type rateLimitError interface {
IsRateLimit() bool
}
type permissionDeniedError interface {
IsPermissionDenied() bool
}
type httpClientError struct {
msg string
code int
}
func makeHttpClientError(url string, resp *http.Response) error {
body, _ := ioutil.ReadAll(resp.Body)
msg := fmt.Sprintf("HTTP request failure on %s:\n%d: %s", url, resp.StatusCode, string(body))
return &httpClientError{
msg: msg,
code: resp.StatusCode,
}
}
func (e *httpClientError) Error() string { return e.msg }
func (e *httpClientError) IsRateLimit() bool { return e.code == 429 }
func (e *httpClientError) IsNotFound() bool { return e.code == 404 }
func (e *httpClientError) IsPermissionDenied() bool { return e.code == 401 }
func IsRateLimit(err error) bool {
re, ok := err.(rateLimitError)
return ok && re.IsRateLimit()
}
func IsNotFound(err error) bool {
nf, ok := err.(notFoundError)
return ok && nf.IsNotFound()
}
func IsPermissionDenied(err error) bool {
pd, ok := err.(permissionDeniedError)
return ok && pd.IsPermissionDenied()
}

14
vendor/github.com/adlio/trello/label.go generated vendored Normal file
View File

@ -0,0 +1,14 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
type Label struct {
ID string `json:"id"`
IDBoard string `json:"idBoard"`
Name string `json:"name"`
Color string `json:"color"`
Uses int `json:"uses"`
}

9
vendor/github.com/adlio/trello/list-duration-sort.go generated vendored Normal file
View File

@ -0,0 +1,9 @@
package trello
type ByFirstEntered []*ListDuration
func (durs ByFirstEntered) Len() int { return len(durs) }
func (durs ByFirstEntered) Less(i, j int) bool {
return durs[i].FirstEntered.Before(durs[j].FirstEntered)
}
func (durs ByFirstEntered) Swap(i, j int) { durs[i], durs[j] = durs[j], durs[i] }

82
vendor/github.com/adlio/trello/list-duration.go generated vendored Normal file
View File

@ -0,0 +1,82 @@
package trello
import (
"sort"
"time"
"github.com/pkg/errors"
)
type ListDuration struct {
ListID string
ListName string
Duration time.Duration
FirstEntered time.Time
TimesInList int
}
func (l *ListDuration) AddDuration(d time.Duration) {
l.Duration = l.Duration + d
l.TimesInList++
}
// Analytzes a Cards actions to figure out how long it was in each List
func (c *Card) GetListDurations() (durations []*ListDuration, err error) {
var actions ActionCollection
if len(c.Actions) == 0 {
// Get all actions which affected the Card's List
c.client.log("[trello] GetListDurations() called on card '%s' without any Card.Actions. Fetching fresh.", c.ID)
actions, err = c.GetListChangeActions()
if err != nil {
err = errors.Wrap(err, "GetListChangeActions() call failed.")
return
}
} else {
actions = c.Actions.FilterToListChangeActions()
}
return actions.GetListDurations()
}
func (actions ActionCollection) GetListDurations() (durations []*ListDuration, err error) {
sort.Sort(actions)
var prevTime time.Time
var prevList *List
durs := make(map[string]*ListDuration)
for _, action := range actions {
if action.DidChangeListForCard() {
if prevList != nil {
duration := action.Date.Sub(prevTime)
_, durExists := durs[prevList.ID]
if !durExists {
durs[prevList.ID] = &ListDuration{ListID: prevList.ID, ListName: prevList.Name, Duration: duration, TimesInList: 1, FirstEntered: prevTime}
} else {
durs[prevList.ID].AddDuration(duration)
}
}
prevList = ListAfterAction(action)
prevTime = action.Date
}
}
if prevList != nil {
duration := time.Now().Sub(prevTime)
_, durExists := durs[prevList.ID]
if !durExists {
durs[prevList.ID] = &ListDuration{ListID: prevList.ID, ListName: prevList.Name, Duration: duration, TimesInList: 1, FirstEntered: prevTime}
} else {
durs[prevList.ID].AddDuration(duration)
}
}
durations = make([]*ListDuration, 0, len(durs))
for _, ld := range durs {
durations = append(durations, ld)
}
sort.Sort(ByFirstEntered(durations))
return durations, nil
}

51
vendor/github.com/adlio/trello/list.go generated vendored Normal file
View File

@ -0,0 +1,51 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
"time"
)
type List struct {
client *Client
ID string `json:"id"`
Name string `json:"name"`
IDBoard string `json:"idBoard,omitempty"`
Closed bool `json:"closed"`
Pos float32 `json:"pos,omitempty"`
Board *Board `json:"board,omitempty"`
Cards []*Card `json:"cards,omitempty"`
}
func (l *List) CreatedAt() time.Time {
t, _ := IDToTime(l.ID)
return t
}
func (c *Client) GetList(listID string, args Arguments) (list *List, err error) {
path := fmt.Sprintf("lists/%s", listID)
err = c.Get(path, args, &list)
if list != nil {
list.client = c
for i := range list.Cards {
list.Cards[i].client = c
}
}
return
}
func (b *Board) GetLists(args Arguments) (lists []*List, err error) {
path := fmt.Sprintf("boards/%s/lists", b.ID)
err = b.client.Get(path, args, &lists)
for i := range lists {
lists[i].client = b.client
for j := range lists[i].Cards {
lists[i].Cards[j].client = b.client
}
}
return
}

118
vendor/github.com/adlio/trello/member-duration.go generated vendored Normal file
View File

@ -0,0 +1,118 @@
package trello
import (
"sort"
"time"
"github.com/pkg/errors"
)
// Used to track the periods of time which a user (member) is attached to a card.
//
type MemberDuration struct {
MemberID string
MemberName string
FirstAdded time.Time
Duration time.Duration
active bool
lastAdded time.Time
}
type ByLongestDuration []*MemberDuration
func (d ByLongestDuration) Len() int { return len(d) }
func (d ByLongestDuration) Less(i, j int) bool { return d[i].Duration > d[j].Duration }
func (d ByLongestDuration) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
func (d *MemberDuration) addAsOf(t time.Time) {
d.active = true
if d.FirstAdded.IsZero() {
d.FirstAdded = t
}
d.startTimerAsOf(t)
}
func (d *MemberDuration) startTimerAsOf(t time.Time) {
if d.active {
d.lastAdded = t
}
}
func (d *MemberDuration) removeAsOf(t time.Time) {
d.stopTimerAsOf(t)
d.active = false
d.lastAdded = time.Time{}
}
func (d *MemberDuration) stopTimerAsOf(t time.Time) {
if d.active {
d.Duration = d.Duration + t.Sub(d.lastAdded)
}
}
func (c *Card) GetMemberDurations() (durations []*MemberDuration, err error) {
var actions ActionCollection
if len(c.Actions) == 0 {
c.client.log("[trello] GetMemberDurations() called on card '%s' without any Card.Actions. Fetching fresh.", c.ID)
actions, err = c.GetMembershipChangeActions()
if err != nil {
err = errors.Wrap(err, "GetMembershipChangeActions() call failed.")
return
}
} else {
actions = c.Actions.FilterToCardMembershipChangeActions()
}
return actions.GetMemberDurations()
}
// Similar to GetListDurations(), this function returns a slice of MemberDuration objects,
// which describes the length of time each member was attached to this card. Durations are
// calculated such that being added to a card starts a timer for that member, and being removed
// starts it again (so that if a person is added and removed multiple times, the duration
// captures only the times which they were attached). Archiving the card also stops the timer.
//
func (actions ActionCollection) GetMemberDurations() (durations []*MemberDuration, err error) {
sort.Sort(actions)
durs := make(map[string]*MemberDuration)
for _, action := range actions {
if action.DidChangeCardMembership() {
_, durExists := durs[action.Member.ID]
if !durExists {
switch action.Type {
case "addMemberToCard":
durs[action.Member.ID] = &MemberDuration{MemberID: action.Member.ID, MemberName: action.Member.FullName}
durs[action.Member.ID].addAsOf(action.Date)
case "removeMemberFromCard":
// Surprisingly, this is possible. If a card was copied, and members were preserved, those
// members exist on the card without a corresponding addMemberToCard action.
t, _ := IDToTime(action.Data.Card.ID)
durs[action.Member.ID] = &MemberDuration{MemberID: action.Member.ID, MemberName: action.Member.FullName, lastAdded: t}
durs[action.Member.ID].removeAsOf(action.Date)
}
} else {
switch action.Type {
case "addMemberToCard":
durs[action.Member.ID].addAsOf(action.Date)
case "removeMemberFromCard":
durs[action.Member.ID].removeAsOf(action.Date)
}
}
} else if action.DidArchiveCard() {
for id, _ := range durs {
durs[id].stopTimerAsOf(action.Date)
}
} else if action.DidUnarchiveCard() {
for id, _ := range durs {
durs[id].startTimerAsOf(action.Date)
}
}
}
durations = make([]*MemberDuration, 0, len(durs))
for _, md := range durs {
durations = append(durations, md)
}
// sort.Sort(ByLongestDuration(durations))
return durations, nil
}

56
vendor/github.com/adlio/trello/member.go generated vendored Normal file
View File

@ -0,0 +1,56 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
)
type Member struct {
client *Client
ID string `json:"id"`
Username string `json:"username"`
FullName string `json:"fullName"`
Initials string `json:"initials"`
AvatarHash string `json:"avatarHash"`
Email string `json:"email"`
}
func (c *Client) GetMember(memberID string, args Arguments) (member *Member, err error) {
path := fmt.Sprintf("members/%s", memberID)
err = c.Get(path, args, &member)
if err == nil {
member.client = c
}
return
}
func (o *Organization) GetMembers(args Arguments) (members []*Member, err error) {
path := fmt.Sprintf("organizations/%s/members", o.ID)
err = o.client.Get(path, args, &members)
for i := range members {
members[i].client = o.client
}
return
}
func (b *Board) GetMembers(args Arguments) (members []*Member, err error) {
path := fmt.Sprintf("boards/%s/members", b.ID)
err = b.client.Get(path, args, &members)
for i := range members {
members[i].client = b.client
}
return
}
func (c *Card) GetMembers(args Arguments) (members []*Member, err error) {
path := fmt.Sprintf("cards/%s/members", c.ID)
err = c.client.Get(path, args, &members)
for i := range members {
members[i].client = c.client
}
return
}

31
vendor/github.com/adlio/trello/organization.go generated vendored Normal file
View File

@ -0,0 +1,31 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
)
type Organization struct {
client *Client
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Desc string `json:"desc"`
URL string `json:"url"`
Website string `json:"website"`
Products []string `json:"products"`
PowerUps []string `json:"powerUps"`
}
func (c *Client) GetOrganization(orgID string, args Arguments) (organization *Organization, err error) {
path := fmt.Sprintf("organizations/%s", orgID)
err = c.Get(path, args, &organization)
if organization != nil {
organization.client = c
}
return
}

57
vendor/github.com/adlio/trello/search.go generated vendored Normal file
View File

@ -0,0 +1,57 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
type SearchResult struct {
Options SearchOptions `json:"options"`
Actions []*Action `json:"actions,omitempty"`
Cards []*Card `json:"cards,omitempty"`
Boards []*Board `json:"boards,omitempty"`
Members []*Member `json:"members,omitempty"`
}
type SearchOptions struct {
Terms []SearchTerm `json:"terms"`
Modifiers []SearchModifier `json:"modifiers,omitempty"`
ModelTypes []string `json:"modelTypes,omitempty"`
Partial bool `json:"partial"`
}
type SearchModifier struct {
Text string `json:"text"`
}
type SearchTerm struct {
Text string `json:"text"`
Negated bool `json:"negated,omitempty"`
}
func (c *Client) SearchCards(query string, args Arguments) (cards []*Card, err error) {
args["query"] = query
args["modelTypes"] = "cards"
res := SearchResult{}
err = c.Get("search", args, &res)
cards = res.Cards
return
}
func (c *Client) SearchBoards(query string, args Arguments) (boards []*Board, err error) {
args["query"] = query
args["modelTypes"] = "boards"
res := SearchResult{}
err = c.Get("search", args, &res)
boards = res.Boards
for _, board := range boards {
board.client = c
}
return
}
func (c *Client) SearchMembers(query string, args Arguments) (members []*Member, err error) {
args["query"] = query
err = c.Get("search/members", args, &members)
return
}

37
vendor/github.com/adlio/trello/token.go generated vendored Normal file
View File

@ -0,0 +1,37 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
"time"
)
type Token struct {
client *Client
ID string `json:"id"`
DateCreated time.Time `json:"dateCreated"`
DateExpires *time.Time `json:"dateExpires"`
IDMember string `json:"idMember"`
Identifier string `json:"identifier"`
Permissions []Permission `json:"permissions"`
}
type Permission struct {
IDModel string `json:"idModel"`
ModelType string `json:"modelType"`
Read bool `json:"read"`
Write bool `json:"write"`
}
func (c *Client) GetToken(tokenID string, args Arguments) (token *Token, err error) {
path := fmt.Sprintf("tokens/%s", tokenID)
err = c.Get(path, args, &token)
if token != nil {
token.client = c
}
return
}

BIN
vendor/github.com/adlio/trello/trello-logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

27
vendor/github.com/adlio/trello/trello.go generated vendored Normal file
View File

@ -0,0 +1,27 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"strconv"
"time"
"github.com/pkg/errors"
)
func IDToTime(id string) (t time.Time, err error) {
if id == "" {
return time.Time{}, nil
}
// The first 8 characters in the object ID are a Unix timestamp
ts, err := strconv.ParseUint(id[:8], 16, 64)
if err != nil {
err = errors.Wrapf(err, "ID '%s' failed to convert to timestamp.", id)
} else {
t = time.Unix(int64(ts), 0)
}
return
}

111
vendor/github.com/adlio/trello/webhook.go generated vendored Normal file
View File

@ -0,0 +1,111 @@
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"encoding/json"
"fmt"
"net/http"
"github.com/pkg/errors"
)
// Webhook is the Go representation of a webhook registered in Trello's systems.
// Used when creating, modifying or deleting webhooks.
//
type Webhook struct {
client *Client
ID string `json:"id,omitempty"`
IDModel string `json:"idModel"`
Description string `json:"description"`
CallbackURL string `json:"callbackURL"`
Active bool `json:"active"`
}
// BoardWebhookRequest is the object sent by Trello to a Webhook for Board-triggered
// webhooks.
//
type BoardWebhookRequest struct {
Model *Board
Action *Action
}
// ListWebhookRequest is the object sent by Trello to a Webhook for List-triggered
// webhooks.
//
type ListWebhookRequest struct {
Model *List
Action *Action
}
// CardWebhookRequest is the object sent by Trello to a Webhook for Card-triggered
// webhooks.
//
type CardWebhookRequest struct {
Model *Card
Action *Action
}
func (c *Client) CreateWebhook(webhook *Webhook) error {
path := "webhooks"
args := Arguments{"idModel": webhook.IDModel, "description": webhook.Description, "callbackURL": webhook.CallbackURL}
err := c.Post(path, args, webhook)
if err == nil {
webhook.client = c
}
return err
}
func (c *Client) GetWebhook(webhookID string, args Arguments) (webhook *Webhook, err error) {
path := fmt.Sprintf("webhooks/%s", webhookID)
err = c.Get(path, args, &webhook)
if webhook != nil {
webhook.client = c
}
return
}
func (t *Token) GetWebhooks(args Arguments) (webhooks []*Webhook, err error) {
path := fmt.Sprintf("tokens/%s/webhooks", t.ID)
err = t.client.Get(path, args, &webhooks)
return
}
func GetBoardWebhookRequest(r *http.Request) (whr *BoardWebhookRequest, err error) {
if r.Method == "HEAD" {
return &BoardWebhookRequest{}, nil
}
decoder := json.NewDecoder(r.Body)
err = decoder.Decode(&whr)
if err != nil {
err = errors.Wrapf(err, "GetBoardWebhookRequest() failed to decode '%s'.", r.URL)
}
return
}
func GetListWebhookRequest(r *http.Request) (whr *ListWebhookRequest, err error) {
if r.Method == "HEAD" {
return &ListWebhookRequest{}, nil
}
decoder := json.NewDecoder(r.Body)
err = decoder.Decode(&whr)
if err != nil {
err = errors.Wrapf(err, "GetListWebhookRequest() failed to decode '%s'.", r.URL)
}
return
}
func GetCardWebhookRequest(r *http.Request) (whr *CardWebhookRequest, err error) {
if r.Method == "HEAD" {
return &CardWebhookRequest{}, nil
}
decoder := json.NewDecoder(r.Body)
err = decoder.Decode(&whr)
if err != nil {
err = errors.Wrapf(err, "GetCardWebhookRequest() failed to decode '%s'.", r.URL)
}
return
}

View File

@ -89,13 +89,16 @@ package main
import (
"log"
"fmt"
"os"
// Shortening the import reference name seems to make it a bit easier
owm "github.com/briandowns/openweathermap"
)
var apiKey = os.Getenv("OWM_API_KEY")
func main() {
w, err := owm.NewCurrent("F", "ru") // fahrenheit (imperial) with Russian output
w, err := owm.NewCurrent("F", "ru", apiKey) // fahrenheit (imperial) with Russian output
if err != nil {
log.Fatalln(err)
}
@ -103,13 +106,14 @@ func main() {
w.CurrentByName("Phoenix")
fmt.Println(w)
}
```
### Current Conditions by location name
```Go
func main() {
w, err := owm.NewCurrent("K", "EN") // (internal - OpenWeatherMap reference for kelvin) with English output
w, err := owm.NewCurrent("K", "EN", apiKey) // (internal - OpenWeatherMap reference for kelvin) with English output
if err != nil {
log.Fatalln(err)
}
@ -123,16 +127,17 @@ func main() {
```Go
func main() {
w, err := owm.NewForecast("F", "FI")
w, err := owm.NewForecast("5", "F", "FI", apiKey) // valid options for first parameter are "5" and "16"
if err != nil {
log.Fatalln(err)
}
w.DailyByCoordinates(
&Coordinates{
&owm.Coordinates{
Longitude: -112.07,
Latitude: 33.45,
},
5 // five days forecast
)
fmt.Println(w)
}
@ -142,7 +147,7 @@ func main() {
```Go
func main() {
w, err := owm.NewCurrent("C", "PL")
w, err := owm.NewCurrent("C", "PL", apiKey)
if err != nil {
log.Fatalln(err)
}
@ -156,7 +161,7 @@ func main() {
```Go
func main() {
w, err := owm.NewCurrent("F", "EN")
w, err := owm.NewCurrent("F", "EN", apiKey)
if err != nil {
log.Fatalln(err)
}
@ -171,7 +176,7 @@ func main() {
```Go
func main() {
client := &http.Client{}
w, err := owm.NewCurrent("F", "EN", owm.WithHttpClient(client))
w, err := owm.NewCurrent("F", "EN", apiKey, owm.WithHttpClient(client))
if err != nil {
log.Fatalln(err)
}
@ -182,19 +187,21 @@ func main() {
```Go
func main() {
uv, err := NewUV()
uv, err := owm.NewUV(apiKey)
if err != nil {
log.Fatalln(err)
}
coord := &Coordinates{
coord := &owm.Coordinates{
Longitude: 53.343497,
Latitude: -6.288379,
}
if err := uv.Current(coord); err != nil {
t.Error(err)
log.Fatalln(err)
}
fmt.Println(coord)
}
```
@ -202,12 +209,12 @@ func main() {
```Go
func main() {
uv, err := NewUV()
uv, err := owm.NewUV(apiKey)
if err != nil {
log.Fatalln(err)
}
coord := &Coordinates{
coord := &owm.Coordinates{
Longitude: 54.995656,
Latitude: -7.326834,
}
@ -225,19 +232,26 @@ func main() {
```Go
func main() {
uv, err := NewUV()
uv, err := owm.NewUV(apiKey)
if err != nil {
log.Fatalln(err)
}
if err := uv.Current(coords); err != nil {
t.Error(err)
coord := &owm.Coordinates{
Longitude: 53.343497,
Latitude: -6.288379,
}
if err := uv.Current(coord); err != nil {
log.Fatalln(err)
}
info, err := uv.UVInformation()
if err != nil {
log.Fatalln(err)
}
fmt.Println(info)
}
```
@ -245,13 +259,13 @@ func main() {
```Go
func main() {
pollution, err := NewPollution()
pollution, err := owm.NewPollution(apiKey)
if err != nil {
log.Fatalln(err)
}
params := &PollutionParameters{
Location: Coordinates{
params := &owm.PollutionParameters{
Location: owm.Coordinates{
Latitude: 0.0,
Longitude: 10.0,
},

View File

@ -108,7 +108,7 @@ func (s UserStats) String() string {
return Stringify(s)
}
//GistStats represents the number of total, private and public gists.
// GistStats represents the number of total, private and public gists.
type GistStats struct {
TotalGists *int `json:"total_gists,omitempty"`
PrivateGists *int `json:"private_gists,omitempty"`

24
vendor/github.com/pkg/errors/.gitignore generated vendored Normal file
View File

@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof

11
vendor/github.com/pkg/errors/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,11 @@
language: go
go_import_path: github.com/pkg/errors
go:
- 1.4.3
- 1.5.4
- 1.6.2
- 1.7.1
- tip
script:
- go test -v ./...

23
vendor/github.com/pkg/errors/LICENSE generated vendored Normal file
View File

@ -0,0 +1,23 @@
Copyright (c) 2015, Dave Cheney <dave@cheney.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

52
vendor/github.com/pkg/errors/README.md generated vendored Normal file
View File

@ -0,0 +1,52 @@
# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors)
Package errors provides simple error handling primitives.
`go get github.com/pkg/errors`
The traditional error handling idiom in Go is roughly akin to
```go
if err != nil {
return err
}
```
which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
## Adding context to an error
The errors.Wrap function returns a new error that adds context to the original error. For example
```go
_, err := ioutil.ReadAll(r)
if err != nil {
return errors.Wrap(err, "read failed")
}
```
## Retrieving the cause of an error
Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
```go
type causer interface {
Cause() error
}
```
`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
```go
switch err := errors.Cause(err).(type) {
case *MyError:
// handle specifically
default:
// unknown error
}
```
[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
## Contributing
We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.
Before proposing a change, please discuss your change by raising an issue.
## Licence
BSD-2-Clause

32
vendor/github.com/pkg/errors/appveyor.yml generated vendored Normal file
View File

@ -0,0 +1,32 @@
version: build-{build}.{branch}
clone_folder: C:\gopath\src\github.com\pkg\errors
shallow_clone: true # for startup speed
environment:
GOPATH: C:\gopath
platform:
- x64
# http://www.appveyor.com/docs/installed-software
install:
# some helpful output for debugging builds
- go version
- go env
# pre-installed MinGW at C:\MinGW is 32bit only
# but MSYS2 at C:\msys64 has mingw64
- set PATH=C:\msys64\mingw64\bin;%PATH%
- gcc --version
- g++ --version
build_script:
- go install -v ./...
test_script:
- set PATH=C:\gopath\bin;%PATH%
- go test -v ./...
#artifacts:
# - path: '%GOPATH%\bin\*.exe'
deploy: off

269
vendor/github.com/pkg/errors/errors.go generated vendored Normal file
View File

@ -0,0 +1,269 @@
// Package errors provides simple error handling primitives.
//
// The traditional error handling idiom in Go is roughly akin to
//
// if err != nil {
// return err
// }
//
// which applied recursively up the call stack results in error reports
// without context or debugging information. The errors package allows
// programmers to add context to the failure path in their code in a way
// that does not destroy the original value of the error.
//
// Adding context to an error
//
// The errors.Wrap function returns a new error that adds context to the
// original error by recording a stack trace at the point Wrap is called,
// and the supplied message. For example
//
// _, err := ioutil.ReadAll(r)
// if err != nil {
// return errors.Wrap(err, "read failed")
// }
//
// If additional control is required the errors.WithStack and errors.WithMessage
// functions destructure errors.Wrap into its component operations of annotating
// an error with a stack trace and an a message, respectively.
//
// Retrieving the cause of an error
//
// Using errors.Wrap constructs a stack of errors, adding context to the
// preceding error. Depending on the nature of the error it may be necessary
// to reverse the operation of errors.Wrap to retrieve the original error
// for inspection. Any error value which implements this interface
//
// type causer interface {
// Cause() error
// }
//
// can be inspected by errors.Cause. errors.Cause will recursively retrieve
// the topmost error which does not implement causer, which is assumed to be
// the original cause. For example:
//
// switch err := errors.Cause(err).(type) {
// case *MyError:
// // handle specifically
// default:
// // unknown error
// }
//
// causer interface is not exported by this package, but is considered a part
// of stable public API.
//
// Formatted printing of errors
//
// All error values returned from this package implement fmt.Formatter and can
// be formatted by the fmt package. The following verbs are supported
//
// %s print the error. If the error has a Cause it will be
// printed recursively
// %v see %s
// %+v extended format. Each Frame of the error's StackTrace will
// be printed in detail.
//
// Retrieving the stack trace of an error or wrapper
//
// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
// invoked. This information can be retrieved with the following interface.
//
// type stackTracer interface {
// StackTrace() errors.StackTrace
// }
//
// Where errors.StackTrace is defined as
//
// type StackTrace []Frame
//
// The Frame type represents a call site in the stack trace. Frame supports
// the fmt.Formatter interface that can be used for printing information about
// the stack trace of this error. For example:
//
// if err, ok := err.(stackTracer); ok {
// for _, f := range err.StackTrace() {
// fmt.Printf("%+s:%d", f)
// }
// }
//
// stackTracer interface is not exported by this package, but is considered a part
// of stable public API.
//
// See the documentation for Frame.Format for more details.
package errors
import (
"fmt"
"io"
)
// New returns an error with the supplied message.
// New also records the stack trace at the point it was called.
func New(message string) error {
return &fundamental{
msg: message,
stack: callers(),
}
}
// Errorf formats according to a format specifier and returns the string
// as a value that satisfies error.
// Errorf also records the stack trace at the point it was called.
func Errorf(format string, args ...interface{}) error {
return &fundamental{
msg: fmt.Sprintf(format, args...),
stack: callers(),
}
}
// fundamental is an error that has a message and a stack, but no caller.
type fundamental struct {
msg string
*stack
}
func (f *fundamental) Error() string { return f.msg }
func (f *fundamental) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
io.WriteString(s, f.msg)
f.stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, f.msg)
case 'q':
fmt.Fprintf(s, "%q", f.msg)
}
}
// WithStack annotates err with a stack trace at the point WithStack was called.
// If err is nil, WithStack returns nil.
func WithStack(err error) error {
if err == nil {
return nil
}
return &withStack{
err,
callers(),
}
}
type withStack struct {
error
*stack
}
func (w *withStack) Cause() error { return w.error }
func (w *withStack) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", w.Cause())
w.stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, w.Error())
case 'q':
fmt.Fprintf(s, "%q", w.Error())
}
}
// Wrap returns an error annotating err with a stack trace
// at the point Wrap is called, and the supplied message.
// If err is nil, Wrap returns nil.
func Wrap(err error, message string) error {
if err == nil {
return nil
}
err = &withMessage{
cause: err,
msg: message,
}
return &withStack{
err,
callers(),
}
}
// Wrapf returns an error annotating err with a stack trace
// at the point Wrapf is call, and the format specifier.
// If err is nil, Wrapf returns nil.
func Wrapf(err error, format string, args ...interface{}) error {
if err == nil {
return nil
}
err = &withMessage{
cause: err,
msg: fmt.Sprintf(format, args...),
}
return &withStack{
err,
callers(),
}
}
// WithMessage annotates err with a new message.
// If err is nil, WithMessage returns nil.
func WithMessage(err error, message string) error {
if err == nil {
return nil
}
return &withMessage{
cause: err,
msg: message,
}
}
type withMessage struct {
cause error
msg string
}
func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
func (w *withMessage) Cause() error { return w.cause }
func (w *withMessage) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v\n", w.Cause())
io.WriteString(s, w.msg)
return
}
fallthrough
case 's', 'q':
io.WriteString(s, w.Error())
}
}
// Cause returns the underlying cause of the error, if possible.
// An error value has a cause if it implements the following
// interface:
//
// type causer interface {
// Cause() error
// }
//
// If the error does not implement Cause, the original error will
// be returned. If the error is nil, nil will be returned without further
// investigation.
func Cause(err error) error {
type causer interface {
Cause() error
}
for err != nil {
cause, ok := err.(causer)
if !ok {
break
}
err = cause.Cause()
}
return err
}

178
vendor/github.com/pkg/errors/stack.go generated vendored Normal file
View File

@ -0,0 +1,178 @@
package errors
import (
"fmt"
"io"
"path"
"runtime"
"strings"
)
// Frame represents a program counter inside a stack frame.
type Frame uintptr
// pc returns the program counter for this frame;
// multiple frames may have the same PC value.
func (f Frame) pc() uintptr { return uintptr(f) - 1 }
// file returns the full path to the file that contains the
// function for this Frame's pc.
func (f Frame) file() string {
fn := runtime.FuncForPC(f.pc())
if fn == nil {
return "unknown"
}
file, _ := fn.FileLine(f.pc())
return file
}
// line returns the line number of source code of the
// function for this Frame's pc.
func (f Frame) line() int {
fn := runtime.FuncForPC(f.pc())
if fn == nil {
return 0
}
_, line := fn.FileLine(f.pc())
return line
}
// Format formats the frame according to the fmt.Formatter interface.
//
// %s source file
// %d source line
// %n function name
// %v equivalent to %s:%d
//
// Format accepts flags that alter the printing of some verbs, as follows:
//
// %+s path of source file relative to the compile time GOPATH
// %+v equivalent to %+s:%d
func (f Frame) Format(s fmt.State, verb rune) {
switch verb {
case 's':
switch {
case s.Flag('+'):
pc := f.pc()
fn := runtime.FuncForPC(pc)
if fn == nil {
io.WriteString(s, "unknown")
} else {
file, _ := fn.FileLine(pc)
fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
}
default:
io.WriteString(s, path.Base(f.file()))
}
case 'd':
fmt.Fprintf(s, "%d", f.line())
case 'n':
name := runtime.FuncForPC(f.pc()).Name()
io.WriteString(s, funcname(name))
case 'v':
f.Format(s, 's')
io.WriteString(s, ":")
f.Format(s, 'd')
}
}
// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
type StackTrace []Frame
func (st StackTrace) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
switch {
case s.Flag('+'):
for _, f := range st {
fmt.Fprintf(s, "\n%+v", f)
}
case s.Flag('#'):
fmt.Fprintf(s, "%#v", []Frame(st))
default:
fmt.Fprintf(s, "%v", []Frame(st))
}
case 's':
fmt.Fprintf(s, "%s", []Frame(st))
}
}
// stack represents a stack of program counters.
type stack []uintptr
func (s *stack) Format(st fmt.State, verb rune) {
switch verb {
case 'v':
switch {
case st.Flag('+'):
for _, pc := range *s {
f := Frame(pc)
fmt.Fprintf(st, "\n%+v", f)
}
}
}
}
func (s *stack) StackTrace() StackTrace {
f := make([]Frame, len(*s))
for i := 0; i < len(f); i++ {
f[i] = Frame((*s)[i])
}
return f
}
func callers() *stack {
const depth = 32
var pcs [depth]uintptr
n := runtime.Callers(3, pcs[:])
var st stack = pcs[0:n]
return &st
}
// funcname removes the path prefix component of a function's name reported by func.Name().
func funcname(name string) string {
i := strings.LastIndex(name, "/")
name = name[i+1:]
i = strings.Index(name, ".")
return name[i+1:]
}
func trimGOPATH(name, file string) string {
// Here we want to get the source file path relative to the compile time
// GOPATH. As of Go 1.6.x there is no direct way to know the compiled
// GOPATH at runtime, but we can infer the number of path segments in the
// GOPATH. We note that fn.Name() returns the function name qualified by
// the import path, which does not include the GOPATH. Thus we can trim
// segments from the beginning of the file path until the number of path
// separators remaining is one more than the number of path separators in
// the function name. For example, given:
//
// GOPATH /home/user
// file /home/user/src/pkg/sub/file.go
// fn.Name() pkg/sub.Type.Method
//
// We want to produce:
//
// pkg/sub/file.go
//
// From this we can easily see that fn.Name() has one less path separator
// than our desired output. We count separators from the end of the file
// path until it finds two more than in the function name and then move
// one character forward to preserve the initial path segment without a
// leading separator.
const sep = "/"
goal := strings.Count(name, sep) + 2
i := len(file)
for n := 0; n < goal; n++ {
i = strings.LastIndex(file[:i], sep)
if i == -1 {
// not enough separators found, set i so that the slice expression
// below leaves file unmodified
i = -len(sep)
break
}
}
// get back to 0 or trim the leading separator
file = file[i+len(sep):]
return file
}

45
vendor/github.com/rivo/tview/borders.go generated vendored Normal file
View File

@ -0,0 +1,45 @@
package tview
// Borders defines various borders used when primitives are drawn.
// These may be changed to accommodate a different look and feel.
var Borders = struct {
Horizontal rune
Vertical rune
TopLeft rune
TopRight rune
BottomLeft rune
BottomRight rune
LeftT rune
RightT rune
TopT rune
BottomT rune
Cross rune
HorizontalFocus rune
VerticalFocus rune
TopLeftFocus rune
TopRightFocus rune
BottomLeftFocus rune
BottomRightFocus rune
}{
Horizontal: BoxDrawingsLightHorizontal,
Vertical: BoxDrawingsLightVertical,
TopLeft: BoxDrawingsLightDownAndRight,
TopRight: BoxDrawingsLightDownAndLeft,
BottomLeft: BoxDrawingsLightUpAndRight,
BottomRight: BoxDrawingsLightUpAndLeft,
LeftT: BoxDrawingsLightVerticalAndRight,
RightT: BoxDrawingsLightVerticalAndLeft,
TopT: BoxDrawingsLightDownAndHorizontal,
BottomT: BoxDrawingsLightUpAndHorizontal,
Cross: BoxDrawingsLightVerticalAndHorizontal,
HorizontalFocus: BoxDrawingsDoubleHorizontal,
VerticalFocus: BoxDrawingsDoubleVertical,
TopLeftFocus: BoxDrawingsDoubleDownAndRight,
TopRightFocus: BoxDrawingsDoubleDownAndLeft,
BottomLeftFocus: BoxDrawingsDoubleUpAndRight,
BottomRightFocus: BoxDrawingsDoubleUpAndLeft,
}

34
vendor/github.com/rivo/tview/box.go generated vendored
View File

@ -236,27 +236,27 @@ func (b *Box) Draw(screen tcell.Screen) {
border := background.Foreground(b.borderColor)
var vertical, horizontal, topLeft, topRight, bottomLeft, bottomRight rune
if b.focus.HasFocus() {
vertical = GraphicsDbVertBar
horizontal = GraphicsDbHorBar
topLeft = GraphicsDbTopLeftCorner
topRight = GraphicsDbTopRightCorner
bottomLeft = GraphicsDbBottomLeftCorner
bottomRight = GraphicsDbBottomRightCorner
horizontal = Borders.HorizontalFocus
vertical = Borders.VerticalFocus
topLeft = Borders.TopLeftFocus
topRight = Borders.TopRightFocus
bottomLeft = Borders.BottomLeftFocus
bottomRight = Borders.BottomRightFocus
} else {
vertical = GraphicsHoriBar
horizontal = GraphicsVertBar
topLeft = GraphicsTopLeftCorner
topRight = GraphicsTopRightCorner
bottomLeft = GraphicsBottomLeftCorner
bottomRight = GraphicsBottomRightCorner
horizontal = Borders.Horizontal
vertical = Borders.Vertical
topLeft = Borders.TopLeft
topRight = Borders.TopRight
bottomLeft = Borders.BottomLeft
bottomRight = Borders.BottomRight
}
for x := b.x + 1; x < b.x+b.width-1; x++ {
screen.SetContent(x, b.y, vertical, nil, border)
screen.SetContent(x, b.y+b.height-1, vertical, nil, border)
screen.SetContent(x, b.y, horizontal, nil, border)
screen.SetContent(x, b.y+b.height-1, horizontal, nil, border)
}
for y := b.y + 1; y < b.y+b.height-1; y++ {
screen.SetContent(b.x, y, horizontal, nil, border)
screen.SetContent(b.x+b.width-1, y, horizontal, nil, border)
screen.SetContent(b.x, y, vertical, nil, border)
screen.SetContent(b.x+b.width-1, y, vertical, nil, border)
}
screen.SetContent(b.x, b.y, topLeft, nil, border)
screen.SetContent(b.x+b.width-1, b.y, topRight, nil, border)
@ -269,7 +269,7 @@ func (b *Box) Draw(screen tcell.Screen) {
if StringWidth(b.title)-printed > 0 && printed > 0 {
_, _, style, _ := screen.GetContent(b.x+b.width-2, b.y)
fg, _, _ := style.Decompose()
Print(screen, string(GraphicsEllipsis), b.x+b.width-2, b.y, 1, AlignLeft, fg)
Print(screen, string(SemigraphicsHorizontalEllipsis), b.x+b.width-2, b.y, 1, AlignLeft, fg)
}
}
}

17
vendor/github.com/rivo/tview/flex.go generated vendored
View File

@ -28,7 +28,7 @@ type Flex struct {
*Box
// The items to be positioned.
items []flexItem
items []*flexItem
// FlexRow or FlexColumn.
direction int
@ -86,7 +86,7 @@ func (f *Flex) SetFullScreen(fullScreen bool) *Flex {
// You can provide a nil value for the primitive. This will still consume screen
// space but nothing will be drawn.
func (f *Flex) AddItem(item Primitive, fixedSize, proportion int, focus bool) *Flex {
f.items = append(f.items, flexItem{Item: item, FixedSize: fixedSize, Proportion: proportion, Focus: focus})
f.items = append(f.items, &flexItem{Item: item, FixedSize: fixedSize, Proportion: proportion, Focus: focus})
return f
}
@ -101,6 +101,19 @@ func (f *Flex) RemoveItem(p Primitive) *Flex {
return f
}
// ResizeItem sets a new size for the item(s) with the given primitive. If there
// are multiple Flex items with the same primitive, they will all receive the
// same size. For details regarding the size parameters, see AddItem().
func (f *Flex) ResizeItem(p Primitive, fixedSize, proportion int) *Flex {
for _, item := range f.items {
if item.Item == p {
item.FixedSize = fixedSize
item.Proportion = proportion
}
}
return f
}
// Draw draws this primitive onto the screen.
func (f *Flex) Draw(screen tcell.Screen) {
f.Box.Draw(screen)

16
vendor/github.com/rivo/tview/grid.go generated vendored
View File

@ -590,11 +590,11 @@ func (g *Grid) Draw(screen tcell.Screen) {
}
by := item.y - 1
if by >= 0 && by < height {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsHoriBar, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.Horizontal, g.bordersColor)
}
by = item.y + item.h
if by >= 0 && by < height {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsHoriBar, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.Horizontal, g.bordersColor)
}
}
for by := item.y; by < item.y+item.h; by++ { // Left/right lines.
@ -603,28 +603,28 @@ func (g *Grid) Draw(screen tcell.Screen) {
}
bx := item.x - 1
if bx >= 0 && bx < width {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsVertBar, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.Vertical, g.bordersColor)
}
bx = item.x + item.w
if bx >= 0 && bx < width {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsVertBar, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.Vertical, g.bordersColor)
}
}
bx, by := item.x-1, item.y-1 // Top-left corner.
if bx >= 0 && bx < width && by >= 0 && by < height {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsTopLeftCorner, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.TopLeft, g.bordersColor)
}
bx, by = item.x+item.w, item.y-1 // Top-right corner.
if bx >= 0 && bx < width && by >= 0 && by < height {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsTopRightCorner, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.TopRight, g.bordersColor)
}
bx, by = item.x-1, item.y+item.h // Bottom-left corner.
if bx >= 0 && bx < width && by >= 0 && by < height {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsBottomLeftCorner, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.BottomLeft, g.bordersColor)
}
bx, by = item.x+item.w, item.y+item.h // Bottom-right corner.
if bx >= 0 && bx < width && by >= 0 && by < height {
PrintJoinedBorder(screen, x+bx, y+by, GraphicsBottomRightCorner, g.bordersColor)
PrintJoinedSemigraphics(screen, x+bx, y+by, Borders.BottomRight, g.bordersColor)
}
}
}

296
vendor/github.com/rivo/tview/semigraphics.go generated vendored Normal file
View File

@ -0,0 +1,296 @@
package tview
import "github.com/gdamore/tcell"
// Semigraphics provides an easy way to access unicode characters for drawing.
//
// Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
// isn't prefixed itself.
const (
// Block: General Punctation U+2000-U+206F (http://unicode.org/charts/PDF/U2000.pdf)
SemigraphicsHorizontalEllipsis rune = '\u2026' // …
// Block: Box Drawing U+2500-U+257F (http://unicode.org/charts/PDF/U2500.pdf)
BoxDrawingsLightHorizontal rune = '\u2500' // ─
BoxDrawingsHeavyHorizontal rune = '\u2501' // ━
BoxDrawingsLightVertical rune = '\u2502' // │
BoxDrawingsHeavyVertical rune = '\u2503' // ┃
BoxDrawingsLightTripleDashHorizontal rune = '\u2504' // ┄
BoxDrawingsHeavyTripleDashHorizontal rune = '\u2505' // ┅
BoxDrawingsLightTripleDashVertical rune = '\u2506' // ┆
BoxDrawingsHeavyTripleDashVertical rune = '\u2507' // ┇
BoxDrawingsLightQuadrupleDashHorizontal rune = '\u2508' // ┈
BoxDrawingsHeavyQuadrupleDashHorizontal rune = '\u2509' // ┉
BoxDrawingsLightQuadrupleDashVertical rune = '\u250a' // ┊
BoxDrawingsHeavyQuadrupleDashVertical rune = '\u250b' // ┋
BoxDrawingsLightDownAndRight rune = '\u250c' // ┌
BoxDrawingsDownLighAndRightHeavy rune = '\u250d' // ┍
BoxDrawingsDownHeavyAndRightLight rune = '\u250e' // ┎
BoxDrawingsHeavyDownAndRight rune = '\u250f' // ┏
BoxDrawingsLightDownAndLeft rune = '\u2510' // ┐
BoxDrawingsDownLighAndLeftHeavy rune = '\u2511' // ┑
BoxDrawingsDownHeavyAndLeftLight rune = '\u2512' // ┒
BoxDrawingsHeavyDownAndLeft rune = '\u2513' // ┓
BoxDrawingsLightUpAndRight rune = '\u2514' // └
BoxDrawingsUpLightAndRightHeavy rune = '\u2515' // ┕
BoxDrawingsUpHeavyAndRightLight rune = '\u2516' // ┖
BoxDrawingsHeavyUpAndRight rune = '\u2517' // ┗
BoxDrawingsLightUpAndLeft rune = '\u2518' // ┘
BoxDrawingsUpLightAndLeftHeavy rune = '\u2519' // ┙
BoxDrawingsUpHeavyAndLeftLight rune = '\u251a' // ┚
BoxDrawingsHeavyUpAndLeft rune = '\u251b' // ┛
BoxDrawingsLightVerticalAndRight rune = '\u251c' // ├
BoxDrawingsVerticalLightAndRightHeavy rune = '\u251d' // ┝
BoxDrawingsUpHeavyAndRightDownLight rune = '\u251e' // ┞
BoxDrawingsDownHeacyAndRightUpLight rune = '\u251f' // ┟
BoxDrawingsVerticalHeavyAndRightLight rune = '\u2520' // ┠
BoxDrawingsDownLightAnbdRightUpHeavy rune = '\u2521' // ┡
BoxDrawingsUpLightAndRightDownHeavy rune = '\u2522' // ┢
BoxDrawingsHeavyVerticalAndRight rune = '\u2523' // ┣
BoxDrawingsLightVerticalAndLeft rune = '\u2524' // ┤
BoxDrawingsVerticalLightAndLeftHeavy rune = '\u2525' // ┥
BoxDrawingsUpHeavyAndLeftDownLight rune = '\u2526' // ┦
BoxDrawingsDownHeavyAndLeftUpLight rune = '\u2527' // ┧
BoxDrawingsVerticalheavyAndLeftLight rune = '\u2528' // ┨
BoxDrawingsDownLightAndLeftUpHeavy rune = '\u2529' // ┨
BoxDrawingsUpLightAndLeftDownHeavy rune = '\u252a' // ┪
BoxDrawingsHeavyVerticalAndLeft rune = '\u252b' // ┫
BoxDrawingsLightDownAndHorizontal rune = '\u252c' // ┬
BoxDrawingsLeftHeavyAndRightDownLight rune = '\u252d' // ┭
BoxDrawingsRightHeavyAndLeftDownLight rune = '\u252e' // ┮
BoxDrawingsDownLightAndHorizontalHeavy rune = '\u252f' // ┯
BoxDrawingsDownHeavyAndHorizontalLight rune = '\u2530' // ┰
BoxDrawingsRightLightAndLeftDownHeavy rune = '\u2531' // ┱
BoxDrawingsLeftLightAndRightDownHeavy rune = '\u2532' // ┲
BoxDrawingsHeavyDownAndHorizontal rune = '\u2533' // ┳
BoxDrawingsLightUpAndHorizontal rune = '\u2534' // ┴
BoxDrawingsLeftHeavyAndRightUpLight rune = '\u2535' // ┵
BoxDrawingsRightHeavyAndLeftUpLight rune = '\u2536' // ┶
BoxDrawingsUpLightAndHorizontalHeavy rune = '\u2537' // ┷
BoxDrawingsUpHeavyAndHorizontalLight rune = '\u2538' // ┸
BoxDrawingsRightLightAndLeftUpHeavy rune = '\u2539' // ┹
BoxDrawingsLeftLightAndRightUpHeavy rune = '\u253a' // ┺
BoxDrawingsHeavyUpAndHorizontal rune = '\u253b' // ┻
BoxDrawingsLightVerticalAndHorizontal rune = '\u253c' // ┼
BoxDrawingsLeftHeavyAndRightVerticalLight rune = '\u253d' // ┽
BoxDrawingsRightHeavyAndLeftVerticalLight rune = '\u253e' // ┾
BoxDrawingsVerticalLightAndHorizontalHeavy rune = '\u253f' // ┿
BoxDrawingsUpHeavyAndDownHorizontalLight rune = '\u2540' // ╀
BoxDrawingsDownHeavyAndUpHorizontalLight rune = '\u2541' // ╁
BoxDrawingsVerticalHeavyAndHorizontalLight rune = '\u2542' // ╂
BoxDrawingsLeftUpHeavyAndRightDownLight rune = '\u2543' // ╃
BoxDrawingsRightUpHeavyAndLeftDownLight rune = '\u2544' // ╄
BoxDrawingsLeftDownHeavyAndRightUpLight rune = '\u2545' // ╅
BoxDrawingsRightDownHeavyAndLeftUpLight rune = '\u2546' // ╆
BoxDrawingsDownLightAndUpHorizontalHeavy rune = '\u2547' // ╇
BoxDrawingsUpLightAndDownHorizontalHeavy rune = '\u2548' // ╈
BoxDrawingsRightLightAndLeftVerticalHeavy rune = '\u2549' // ╉
BoxDrawingsLeftLightAndRightVerticalHeavy rune = '\u254a' // ╊
BoxDrawingsHeavyVerticalAndHorizontal rune = '\u254b' // ╋
BoxDrawingsLightDoubleDashHorizontal rune = '\u254c' // ╌
BoxDrawingsHeavyDoubleDashHorizontal rune = '\u254d' // ╍
BoxDrawingsLightDoubleDashVertical rune = '\u254e' // ╎
BoxDrawingsHeavyDoubleDashVertical rune = '\u254f' // ╏
BoxDrawingsDoubleHorizontal rune = '\u2550' // ═
BoxDrawingsDoubleVertical rune = '\u2551' // ║
BoxDrawingsDownSingleAndRightDouble rune = '\u2552' // ╒
BoxDrawingsDownDoubleAndRightSingle rune = '\u2553' // ╓
BoxDrawingsDoubleDownAndRight rune = '\u2554' // ╔
BoxDrawingsDownSingleAndLeftDouble rune = '\u2555' // ╕
BoxDrawingsDownDoubleAndLeftSingle rune = '\u2556' // ╖
BoxDrawingsDoubleDownAndLeft rune = '\u2557' // ╗
BoxDrawingsUpSingleAndRightDouble rune = '\u2558' // ╘
BoxDrawingsUpDoubleAndRightSingle rune = '\u2559' // ╙
BoxDrawingsDoubleUpAndRight rune = '\u255a' // ╚
BoxDrawingsUpSingleAndLeftDouble rune = '\u255b' // ╛
BoxDrawingsUpDobuleAndLeftSingle rune = '\u255c' // ╜
BoxDrawingsDoubleUpAndLeft rune = '\u255d' // ╝
BoxDrawingsVerticalSingleAndRightDouble rune = '\u255e' // ╞
BoxDrawingsVerticalDoubleAndRightSingle rune = '\u255f' // ╟
BoxDrawingsDoubleVerticalAndRight rune = '\u2560' // ╠
BoxDrawingsVerticalSingleAndLeftDouble rune = '\u2561' // ╡
BoxDrawingsVerticalDoubleAndLeftSingle rune = '\u2562' // ╢
BoxDrawingsDoubleVerticalAndLeft rune = '\u2563' // ╣
BoxDrawingsDownSingleAndHorizontalDouble rune = '\u2564' // ╤
BoxDrawingsDownDoubleAndHorizontalSingle rune = '\u2565' // ╥
BoxDrawingsDoubleDownAndHorizontal rune = '\u2566' // ╦
BoxDrawingsUpSingleAndHorizontalDouble rune = '\u2567' // ╧
BoxDrawingsUpDoubleAndHorizontalSingle rune = '\u2568' // ╨
BoxDrawingsDoubleUpAndHorizontal rune = '\u2569' // ╩
BoxDrawingsVerticalSingleAndHorizontalDouble rune = '\u256a' // ╪
BoxDrawingsVerticalDoubleAndHorizontalSingle rune = '\u256b' // ╫
BoxDrawingsDoubleVerticalAndHorizontal rune = '\u256c' // ╬
BoxDrawingsLightArcDownAndRight rune = '\u256d' // ╭
BoxDrawingsLightArcDownAndLeft rune = '\u256e' // ╮
BoxDrawingsLightArcUpAndLeft rune = '\u256f' // ╯
BoxDrawingsLightArcUpAndRight rune = '\u2570' // ╰
BoxDrawingsLightDiagonalUpperRightToLowerLeft rune = '\u2571' //
BoxDrawingsLightDiagonalUpperLeftToLowerRight rune = '\u2572' // ╲
BoxDrawingsLightDiagonalCross rune = '\u2573' //
BoxDrawingsLightLeft rune = '\u2574' // ╴
BoxDrawingsLightUp rune = '\u2575' // ╵
BoxDrawingsLightRight rune = '\u2576' // ╶
BoxDrawingsLightDown rune = '\u2577' // ╷
BoxDrawingsHeavyLeft rune = '\u2578' // ╸
BoxDrawingsHeavyUp rune = '\u2579' // ╹
BoxDrawingsHeavyRight rune = '\u257a' // ╺
BoxDrawingsHeavyDown rune = '\u257b' // ╻
BoxDrawingsLightLeftAndHeavyRight rune = '\u257c' // ╼
BoxDrawingsLightUpAndHeavyDown rune = '\u257d' // ╽
BoxDrawingsHeavyLeftAndLightRight rune = '\u257e' // ╾
BoxDrawingsHeavyUpAndLightDown rune = '\u257f' // ╿
)
// SemigraphicJoints is a map for joining semigraphic (or otherwise) runes.
// So far only light lines are supported but if you want to change the border
// styling you need to provide the joints, too.
// The matching will be sorted ascending by rune value, so you don't need to
// provide all rune combinations,
// e.g. (─) + (│) = (┼) will also match (│) + (─) = (┼)
var SemigraphicJoints = map[string]rune{
// (─) + (│) = (┼)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVertical}): BoxDrawingsLightVerticalAndHorizontal,
// (─) + (┌) = (┬)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightDownAndRight}): BoxDrawingsLightDownAndHorizontal,
// (─) + (┐) = (┬)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightDownAndLeft}): BoxDrawingsLightDownAndHorizontal,
// (─) + (└) = (┴)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightUpAndRight}): BoxDrawingsLightUpAndHorizontal,
// (─) + (┘) = (┴)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightUpAndHorizontal,
// (─) + (├) = (┼)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndHorizontal,
// (─) + (┤) = (┼)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
// (─) + (┬) = (┬)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightDownAndHorizontal,
// (─) + (┴) = (┴)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightUpAndHorizontal,
// (─) + (┼) = (┼)
string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (│) + (┌) = (├)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightDownAndRight}): BoxDrawingsLightVerticalAndRight,
// (│) + (┐) = (┤)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightDownAndLeft}): BoxDrawingsLightVerticalAndLeft,
// (│) + (└) = (├)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightUpAndRight}): BoxDrawingsLightVerticalAndRight,
// (│) + (┘) = (┤)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightVerticalAndLeft,
// (│) + (├) = (├)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndRight,
// (│) + (┤) = (┤)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndLeft,
// (│) + (┬) = (┼)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (│) + (┴) = (┼)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (│) + (┼) = (┼)
string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┌) + (┐) = (┬)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightDownAndLeft}): BoxDrawingsLightDownAndHorizontal,
// (┌) + (└) = (├)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightUpAndRight}): BoxDrawingsLightVerticalAndRight,
// (┌) + (┘) = (┼)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
// (┌) + (├) = (├)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndRight,
// (┌) + (┤) = (┼)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
// (┌) + (┬) = (┬)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightDownAndHorizontal,
// (┌) + (┴) = (┼)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┌) + (┴) = (┼)
string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┐) + (└) = (┼)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightUpAndRight}): BoxDrawingsLightVerticalAndHorizontal,
// (┐) + (┘) = (┤)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightVerticalAndLeft,
// (┐) + (├) = (┼)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndHorizontal,
// (┐) + (┤) = (┤)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndLeft,
// (┐) + (┬) = (┬)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightDownAndHorizontal,
// (┐) + (┴) = (┼)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┐) + (┼) = (┼)
string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (└) + (┘) = (┴)
string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightUpAndHorizontal,
// (└) + (├) = (├)
string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndRight,
// (└) + (┤) = (┼)
string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
// (└) + (┬) = (┼)
string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (└) + (┴) = (┴)
string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightUpAndHorizontal,
// (└) + (┼) = (┼)
string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┘) + (├) = (┼)
string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndHorizontal,
// (┘) + (┤) = (┤)
string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndLeft,
// (┘) + (┬) = (┼)
string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┘) + (┴) = (┴)
string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightUpAndHorizontal,
// (┘) + (┼) = (┼)
string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (├) + (┤) = (┼)
string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
// (├) + (┬) = (┼)
string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (├) + (┴) = (┼)
string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (├) + (┼) = (┼)
string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┤) + (┬) = (┼)
string([]rune{BoxDrawingsLightVerticalAndLeft, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┤) + (┴) = (┼)
string([]rune{BoxDrawingsLightVerticalAndLeft, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┤) + (┼) = (┼)
string([]rune{BoxDrawingsLightVerticalAndLeft, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┬) + (┴) = (┼)
string([]rune{BoxDrawingsLightDownAndHorizontal, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┬) + (┼) = (┼)
string([]rune{BoxDrawingsLightDownAndHorizontal, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
// (┴) + (┼) = (┼)
string([]rune{BoxDrawingsLightUpAndHorizontal, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
}
// PrintJoinedSemigraphics prints a semigraphics rune into the screen at the given
// position with the given color, joining it with any existing semigraphics
// rune. Background colors are preserved. At this point, only regular single
// line borders are supported.
func PrintJoinedSemigraphics(screen tcell.Screen, x, y int, ch rune, color tcell.Color) {
previous, _, style, _ := screen.GetContent(x, y)
style = style.Foreground(color)
// What's the resulting rune?
var result rune
if ch == previous {
result = ch
} else {
if ch < previous {
previous, ch = ch, previous
}
result = SemigraphicJoints[string([]rune{previous, ch})]
}
if result == 0 {
result = ch
}
// We only print something if we have something.
screen.SetContent(x, y, result, nil, style)
}

View File

@ -278,7 +278,7 @@ func (t *Table) SetBordersColor(color tcell.Color) *Table {
// SetSeparator sets the character used to fill the space between two
// neighboring cells. This is a space character ' ' per default but you may
// want to set it to GraphicsVertBar (or any other rune) if the column
// want to set it to Borders.Vertical (or any other rune) if the column
// separation should be more visible. If cell borders are activated, this is
// ignored.
//
@ -668,24 +668,24 @@ ColumnLoop:
// Draw borders.
rowY *= 2
for pos := 0; pos < columnWidth && columnX+1+pos < width; pos++ {
drawBorder(columnX+pos+1, rowY, GraphicsHoriBar)
drawBorder(columnX+pos+1, rowY, Borders.Horizontal)
}
ch := GraphicsCross
ch := Borders.Cross
if columnIndex == 0 {
if rowY == 0 {
ch = GraphicsTopLeftCorner
ch = Borders.TopLeft
} else {
ch = GraphicsLeftT
ch = Borders.LeftT
}
} else if rowY == 0 {
ch = GraphicsTopT
ch = Borders.TopT
}
drawBorder(columnX, rowY, ch)
rowY++
if rowY >= height {
break // No space for the text anymore.
}
drawBorder(columnX, rowY, GraphicsVertBar)
drawBorder(columnX, rowY, Borders.Vertical)
} else if columnIndex > 0 {
// Draw separator.
drawBorder(columnX, rowY, t.separator)
@ -706,18 +706,18 @@ ColumnLoop:
_, printed := printWithStyle(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, tcell.StyleDefault.Foreground(cell.Color)|tcell.Style(cell.Attributes))
if StringWidth(cell.Text)-printed > 0 && printed > 0 {
_, _, style, _ := screen.GetContent(x+columnX+1+finalWidth-1, y+rowY)
printWithStyle(screen, string(GraphicsEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, style)
printWithStyle(screen, string(SemigraphicsHorizontalEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, style)
}
}
// Draw bottom border.
if rowY := 2 * len(rows); t.borders && rowY < height {
for pos := 0; pos < columnWidth && columnX+1+pos < width; pos++ {
drawBorder(columnX+pos+1, rowY, GraphicsHoriBar)
drawBorder(columnX+pos+1, rowY, Borders.Horizontal)
}
ch := GraphicsBottomT
ch := Borders.BottomT
if columnIndex == 0 {
ch = GraphicsBottomLeftCorner
ch = Borders.BottomLeft
}
drawBorder(columnX, rowY, ch)
}
@ -730,16 +730,16 @@ ColumnLoop:
for rowY := range rows {
rowY *= 2
if rowY+1 < height {
drawBorder(columnX, rowY+1, GraphicsVertBar)
drawBorder(columnX, rowY+1, Borders.Vertical)
}
ch := GraphicsRightT
ch := Borders.RightT
if rowY == 0 {
ch = GraphicsTopRightCorner
ch = Borders.TopRight
}
drawBorder(columnX, rowY, ch)
}
if rowY := 2 * len(rows); rowY < height {
drawBorder(columnX, rowY, GraphicsBottomRightCorner)
drawBorder(columnX, rowY, Borders.BottomRight)
}
}

View File

@ -5,6 +5,7 @@ import (
"fmt"
"regexp"
"sync"
"unicode"
"unicode/utf8"
"github.com/gdamore/tcell"
@ -659,7 +660,7 @@ func (t *TextView) Draw(screen tcell.Screen) {
t.pageSize = height
// If the width has changed, we need to reindex.
if width != t.lastWidth {
if width != t.lastWidth && t.wrap {
t.index = nil
}
t.lastWidth = width
@ -815,7 +816,7 @@ func (t *TextView) Draw(screen tcell.Screen) {
// Draw the character.
var comb []rune
if len(runeSequence) > 1 {
if len(runeSequence) > 1 && !unicode.IsControl(runeSequence[1]) {
// Allocate space for the combining characters only when necessary.
comb = make([]rune, len(runeSequence)-1)
copy(comb, runeSequence[1:])

113
vendor/github.com/rivo/tview/util.go generated vendored
View File

@ -19,90 +19,6 @@ const (
AlignRight
)
// Semigraphical runes.
const (
GraphicsHoriBar = '\u2500'
GraphicsVertBar = '\u2502'
GraphicsTopLeftCorner = '\u250c'
GraphicsTopRightCorner = '\u2510'
GraphicsBottomLeftCorner = '\u2514'
GraphicsBottomRightCorner = '\u2518'
GraphicsLeftT = '\u251c'
GraphicsRightT = '\u2524'
GraphicsTopT = '\u252c'
GraphicsBottomT = '\u2534'
GraphicsCross = '\u253c'
GraphicsDbVertBar = '\u2550'
GraphicsDbHorBar = '\u2551'
GraphicsDbTopLeftCorner = '\u2554'
GraphicsDbTopRightCorner = '\u2557'
GraphicsDbBottomRightCorner = '\u255d'
GraphicsDbBottomLeftCorner = '\u255a'
GraphicsEllipsis = '\u2026'
)
// joints maps combinations of two graphical runes to the rune that results
// when joining the two in the same screen cell. The keys of this map are
// two-rune strings where the value of the first rune is lower than the value
// of the second rune. Identical runes are not contained.
var joints = map[string]rune{
"\u2500\u2502": GraphicsCross,
"\u2500\u250c": GraphicsTopT,
"\u2500\u2510": GraphicsTopT,
"\u2500\u2514": GraphicsBottomT,
"\u2500\u2518": GraphicsBottomT,
"\u2500\u251c": GraphicsCross,
"\u2500\u2524": GraphicsCross,
"\u2500\u252c": GraphicsTopT,
"\u2500\u2534": GraphicsBottomT,
"\u2500\u253c": GraphicsCross,
"\u2502\u250c": GraphicsLeftT,
"\u2502\u2510": GraphicsRightT,
"\u2502\u2514": GraphicsLeftT,
"\u2502\u2518": GraphicsRightT,
"\u2502\u251c": GraphicsLeftT,
"\u2502\u2524": GraphicsRightT,
"\u2502\u252c": GraphicsCross,
"\u2502\u2534": GraphicsCross,
"\u2502\u253c": GraphicsCross,
"\u250c\u2510": GraphicsTopT,
"\u250c\u2514": GraphicsLeftT,
"\u250c\u2518": GraphicsCross,
"\u250c\u251c": GraphicsLeftT,
"\u250c\u2524": GraphicsCross,
"\u250c\u252c": GraphicsTopT,
"\u250c\u2534": GraphicsCross,
"\u250c\u253c": GraphicsCross,
"\u2510\u2514": GraphicsCross,
"\u2510\u2518": GraphicsRightT,
"\u2510\u251c": GraphicsCross,
"\u2510\u2524": GraphicsRightT,
"\u2510\u252c": GraphicsTopT,
"\u2510\u2534": GraphicsCross,
"\u2510\u253c": GraphicsCross,
"\u2514\u2518": GraphicsBottomT,
"\u2514\u251c": GraphicsLeftT,
"\u2514\u2524": GraphicsCross,
"\u2514\u252c": GraphicsCross,
"\u2514\u2534": GraphicsBottomT,
"\u2514\u253c": GraphicsCross,
"\u2518\u251c": GraphicsCross,
"\u2518\u2524": GraphicsRightT,
"\u2518\u252c": GraphicsCross,
"\u2518\u2534": GraphicsBottomT,
"\u2518\u253c": GraphicsCross,
"\u251c\u2524": GraphicsCross,
"\u251c\u252c": GraphicsCross,
"\u251c\u2534": GraphicsCross,
"\u251c\u253c": GraphicsCross,
"\u2524\u252c": GraphicsCross,
"\u2524\u2534": GraphicsCross,
"\u2524\u253c": GraphicsCross,
"\u252c\u2534": GraphicsCross,
"\u252c\u253c": GraphicsCross,
"\u2534\u253c": GraphicsCross,
}
// Common regular expressions.
var (
colorPattern = regexp.MustCompile(`\[([a-zA-Z]+|#[0-9a-zA-Z]{6}|\-)?(:([a-zA-Z]+|#[0-9a-zA-Z]{6}|\-)?(:([lbdru]+|\-)?)?)?\]`)
@ -419,7 +335,7 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
_, background, _ := finalStyle.Decompose()
finalStyle = overlayStyle(background, style, foregroundColor, backgroundColor, attributes)
var comb []rune
if len(runeSequence) > 1 {
if len(runeSequence) > 1 && !unicode.IsControl(runeSequence[1]) {
// Allocate space for the combining characters only when necessary.
comb = make([]rune, len(runeSequence)-1)
copy(comb, runeSequence[1:])
@ -475,7 +391,6 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
}
runeSequence = append(runeSequence, ch)
runeSeqWidth += chWidth
}
if drawnWidth+runeSeqWidth <= maxWidth {
flush()
@ -608,32 +523,6 @@ func WordWrap(text string, width int) (lines []string) {
return
}
// PrintJoinedBorder prints a border graphics rune into the screen at the given
// position with the given color, joining it with any existing border graphics
// rune. Background colors are preserved. At this point, only regular single
// line borders are supported.
func PrintJoinedBorder(screen tcell.Screen, x, y int, ch rune, color tcell.Color) {
previous, _, style, _ := screen.GetContent(x, y)
style = style.Foreground(color)
// What's the resulting rune?
var result rune
if ch == previous {
result = ch
} else {
if ch < previous {
previous, ch = ch, previous
}
result = joints[string(previous)+string(ch)]
}
if result == 0 {
result = ch
}
// We only print something if we have something.
screen.SetContent(x, y, result, nil, style)
}
// Escape escapes the given text such that color and/or region tags are not
// recognized and substituted by the print functions of this package. For
// example, to include a tag-like string in a box title or in a TextView:

View File

@ -680,6 +680,7 @@ func parseID(id interface{}) (string, error) {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/README.html#data-validation-and-error-reporting
type ErrorResponse struct {
Body []byte
Response *http.Response
Message string
}
@ -700,13 +701,15 @@ func CheckResponse(r *http.Response) error {
errorResponse := &ErrorResponse{Response: r}
data, err := ioutil.ReadAll(r.Body)
if err == nil && data != nil {
errorResponse.Body = data
var raw interface{}
if err := json.Unmarshal(data, &raw); err != nil {
errorResponse.Message = "failed to parse unknown error format"
}
} else {
errorResponse.Message = parseError(raw)
}
}
return errorResponse
}

View File

@ -362,6 +362,39 @@ func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...Optio
return s.client.Do(req, nil)
}
// ListMergeRequestsClosingIssueOptions represents the available
// ListMergeRequestsClosingIssue() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge
type ListMergeRequestsClosingIssueOptions ListOptions
// ListMergeRequestsClosingIssue gets all the merge requests that will close
// issue when merged.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge
func (s *IssuesService) ListMergeRequestsClosingIssue(pid interface{}, issue int, opt *ListMergeRequestsClosingIssueOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("/projects/%s/issues/%d/closed_by", url.QueryEscape(project), issue)
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var m []*MergeRequest
resp, err := s.client.Do(req, &m)
if err != nil {
return nil, resp, err
}
return m, resp, err
}
// SetTimeEstimate sets the time estimate for a single project issue.
//
// GitLab API docs:

View File

@ -348,7 +348,7 @@ func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeR
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/merge_requests/%v/pipelines", url.QueryEscape(project), mergeRequest)
u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", url.QueryEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
@ -381,7 +381,7 @@ func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequ
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("/projects/%s/merge_requests/%v/closes_issues", url.QueryEscape(project), mergeRequest)
u := fmt.Sprintf("/projects/%s/merge_requests/%d/closes_issues", url.QueryEscape(project), mergeRequest)
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {

View File

@ -101,6 +101,7 @@ var brokenAuthHeaderProviders = []string{
"https://api.pushbullet.com/",
"https://api.soundcloud.com/",
"https://api.twitch.tv/",
"https://id.twitch.tv/",
"https://app.box.com/",
"https://connect.stripe.com/",
"https://login.mailchimp.com/",

View File

@ -48,6 +48,7 @@ Kunpei Sakai <namusyaka@gmail.com>
Matthew Whisenhunt <matt.whisenhunt@gmail.com>
Michael McGreevy <mcgreevy@golang.org>
Nick Craig-Wood <nickcw@gmail.com>
Robbie Trencheny <me@robbiet.us>
Ross Light <light@google.com>
Sarah Adams <shadams@google.com>
Scott Van Woudenberg <scottvw@google.com>

View File

@ -270,11 +270,20 @@ func ProcessMediaOptions(opts []MediaOption) *MediaOptions {
func ResolveRelative(basestr, relstr string) string {
u, _ := url.Parse(basestr)
afterColonPath := ""
if i := strings.IndexRune(relstr, ':'); i > 0 {
afterColonPath = relstr[i+1:]
relstr = relstr[:i]
}
rel, _ := url.Parse(relstr)
u = u.ResolveReference(rel)
us := u.String()
if afterColonPath != "" {
us = fmt.Sprintf("%s:%s", us, afterColonPath)
}
us = strings.Replace(us, "%7B", "{", -1)
us = strings.Replace(us, "%7D", "}", -1)
us = strings.Replace(us, "%2A", "*", -1)
return us
}

5979
vendor/google.golang.org/api/sheets/v4/sheets-api.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

12449
vendor/google.golang.org/api/sheets/v4/sheets-gen.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,24 @@
language: go
go:
- 1.6.3
- 1.7.1
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x
go_import_path: google.golang.org/appengine
install:
- go get -v -t -d google.golang.org/appengine/...
- mkdir sdk
- curl -o sdk.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.40.zip"
- unzip -q sdk.zip -d sdk
- export APPENGINE_DEV_APPSERVER=$(pwd)/sdk/go_appengine/dev_appserver.py
- go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v appengine)
- mkdir /tmp/sdk
- curl -o /tmp/sdk.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.40.zip"
- unzip -q /tmp/sdk.zip -d /tmp/sdk
- export PATH="$PATH:/tmp/sdk/go_appengine"
- export APPENGINE_DEV_APPSERVER=/tmp/sdk/go_appengine/dev_appserver.py
script:
- goapp version
- go version
- go test -v google.golang.org/appengine/...
- go test -v -race google.golang.org/appengine/...
- sdk/go_appengine/goapp test -v google.golang.org/appengine/...
- goapp test -v google.golang.org/appengine/...

90
vendor/google.golang.org/appengine/CONTRIBUTING.md generated vendored Normal file
View File

@ -0,0 +1,90 @@
# Contributing
1. Sign one of the contributor license agreements below.
1. Get the package:
`go get -d google.golang.org/appengine`
1. Change into the checked out source:
`cd $GOPATH/src/google.golang.org/appengine`
1. Fork the repo.
1. Set your fork as a remote:
`git remote add fork git@github.com:GITHUB_USERNAME/appengine.git`
1. Make changes, commit to your fork.
1. Send a pull request with your changes.
The first line of your commit message is conventionally a one-line summary of the change, prefixed by the primary affected package, and is used as the title of your pull request.
# Testing
## Running system tests
Download and install the [Go App Engine SDK](https://cloud.google.com/appengine/docs/go/download). Make sure the `go_appengine` dir is in your `PATH`.
Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`.
Run tests with `goapp test`:
```
goapp test -v google.golang.org/appengine/...
```
## Contributor License Agreements
Before we can accept your pull requests you'll need to sign a Contributor
License Agreement (CLA):
- **If you are an individual writing original source code** and **you own the
intellectual property**, then you'll need to sign an [individual CLA][indvcla].
- **If you work for a company that wants to allow you to contribute your work**,
then you'll need to sign a [corporate CLA][corpcla].
You can sign these electronically (just scroll to the bottom). After that,
we'll be able to accept your pull requests.
## Contributor Code of Conduct
As contributors and maintainers of this project,
and in the interest of fostering an open and welcoming community,
we pledge to respect all people who contribute through reporting issues,
posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.
We are committed to making participation in this project
a harassment-free experience for everyone,
regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information,
such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct.
By adopting this Code of Conduct,
project maintainers commit themselves to fairly and consistently
applying these principles to every aspect of managing this project.
Project maintainers who do not follow or enforce the Code of Conduct
may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by opening an issue
or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
[indvcla]: https://developers.google.com/open-source/cla/individual
[corpcla]: https://developers.google.com/open-source/cla/corporate

View File

@ -2,19 +2,27 @@
[![Build Status](https://travis-ci.org/golang/appengine.svg)](https://travis-ci.org/golang/appengine)
This repository supports the Go runtime on App Engine,
including both the standard App Engine and the
"App Engine flexible environment" (formerly known as "Managed VMs").
This repository supports the Go runtime on *App Engine standard*.
It provides APIs for interacting with App Engine services.
Its canonical import path is `google.golang.org/appengine`.
See https://cloud.google.com/appengine/docs/go/
for more information.
File issue reports and feature requests on the [Google App Engine issue
tracker](https://code.google.com/p/googleappengine/issues/entry?template=Go%20defect).
File issue reports and feature requests on the [GitHub's issue
tracker](https://github.com/golang/appengine/issues).
## Upgrading an App Engine app to the flexible environment
This package does not work on *App Engine flexible*.
There are many differences between the App Engine standard environment and
the flexible environment.
See the [documentation on upgrading to the flexible environment](https://cloud.google.com/appengine/docs/flexible/go/upgrading).
## Directory structure
The top level directory of this repository is the `appengine` package. It
contains the
basic APIs (e.g. `appengine.NewContext`) that apply across APIs. Specific API
@ -24,32 +32,24 @@ There is an `internal` subdirectory that contains service protocol buffers,
plus packages required for connectivity to make API calls. App Engine apps
should not directly import any package under `internal`.
## Updating a Go App Engine app
## Updating from legacy (`import "appengine"`) packages
This section describes how to update an older Go App Engine app to use
these packages. A provided tool, `aefix`, can help automate steps 2 and 3
(run `go get google.golang.org/appengine/cmd/aefix` to install it), but
read the details below since `aefix` can't perform all the changes.
If you're currently using the bare `appengine` packages
(that is, not these ones, imported via `google.golang.org/appengine`),
then you can use the `aefix` tool to help automate an upgrade to these packages.
### 1. Update YAML files (App Engine flexible environment / Managed VMs only)
Run `go get google.golang.org/appengine/cmd/aefix` to install it.
The `app.yaml` file (and YAML files for modules) should have these new lines added:
```
vm: true
```
See https://cloud.google.com/appengine/docs/go/modules/#Go_Instance_scaling_and_class for details.
### 2. Update import paths
### 1. Update import paths
The import paths for App Engine packages are now fully qualified, based at `google.golang.org/appengine`.
You will need to update your code to use import paths starting with that; for instance,
code importing `appengine/datastore` will now need to import `google.golang.org/appengine/datastore`.
### 3. Update code using deprecated, removed or modified APIs
### 2. Update code using deprecated, removed or modified APIs
Most App Engine services are available with exactly the same API.
A few APIs were cleaned up, and some are not available yet.
This list summarises the differences:
A few APIs were cleaned up, and there are some differences:
* `appengine.Context` has been replaced with the `Context` type from `golang.org/x/net/context`.
* Logging methods that were on `appengine.Context` are now functions in `google.golang.org/appengine/log`.

View File

@ -28,7 +28,8 @@ import (
// See https://cloud.google.com/appengine/docs/flexible/custom-runtimes#health_check_requests
// for details on how to do your own health checking.
//
// Main is not yet supported on App Engine Standard.
// On App Engine Standard it ensures the server has started and is prepared to
// receive requests.
//
// Main never returns.
//
@ -62,7 +63,7 @@ func IsDevAppServer() bool {
// NewContext returns a context for an in-flight HTTP request.
// This function is cheap.
func NewContext(req *http.Request) context.Context {
return WithContext(context.Background(), req)
return internal.ReqContext(req)
}
// WithContext returns a copy of the parent context

View File

@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// +build !appengine
// +build go1.7
package internal
@ -33,6 +34,7 @@ import (
const (
apiPath = "/rpc_http"
defaultTicketSuffix = "/default.20150612t184001.0"
)
var (
@ -60,6 +62,11 @@ var (
Dial: limitDial,
},
}
defaultTicketOnce sync.Once
defaultTicket string
backgroundContextOnce sync.Once
backgroundContext netcontext.Context
)
func apiURL() *url.URL {
@ -83,16 +90,10 @@ func handleHTTP(w http.ResponseWriter, r *http.Request) {
outHeader: w.Header(),
apiURL: apiURL(),
}
stopFlushing := make(chan int)
r = r.WithContext(withContext(r.Context(), c))
c.req = r
ctxs.Lock()
ctxs.m[r] = c
ctxs.Unlock()
defer func() {
ctxs.Lock()
delete(ctxs.m, r)
ctxs.Unlock()
}()
stopFlushing := make(chan int)
// Patch up RemoteAddr so it looks reasonable.
if addr := r.Header.Get(userIPHeader); addr != "" {
@ -191,18 +192,6 @@ func renderPanic(x interface{}) string {
return string(buf)
}
var ctxs = struct {
sync.Mutex
m map[*http.Request]*context
bg *context // background context, lazily initialized
// dec is used by tests to decorate the netcontext.Context returned
// for a given request. This allows tests to add overrides (such as
// WithAppIDOverride) to the context. The map is nil outside tests.
dec map[*http.Request]func(netcontext.Context) netcontext.Context
}{
m: make(map[*http.Request]*context),
}
// context represents the context of an in-flight HTTP request.
// It implements the appengine.Context and http.ResponseWriter interfaces.
type context struct {
@ -223,6 +212,34 @@ type context struct {
var contextKey = "holds a *context"
// jointContext joins two contexts in a superficial way.
// It takes values and timeouts from a base context, and only values from another context.
type jointContext struct {
base netcontext.Context
valuesOnly netcontext.Context
}
func (c jointContext) Deadline() (time.Time, bool) {
return c.base.Deadline()
}
func (c jointContext) Done() <-chan struct{} {
return c.base.Done()
}
func (c jointContext) Err() error {
return c.base.Err()
}
func (c jointContext) Value(key interface{}) interface{} {
if val := c.base.Value(key); val != nil {
return val
}
return c.valuesOnly.Value(key)
}
// fromContext returns the App Engine context or nil if ctx is not
// derived from an App Engine context.
func fromContext(ctx netcontext.Context) *context {
c, _ := ctx.Value(&contextKey).(*context)
return c
@ -247,43 +264,41 @@ func IncomingHeaders(ctx netcontext.Context) http.Header {
return nil
}
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context {
ctxs.Lock()
c := ctxs.m[req]
d := ctxs.dec[req]
ctxs.Unlock()
if d != nil {
parent = d(parent)
}
if c == nil {
// Someone passed in an http.Request that is not in-flight.
// We panic here rather than panicking at a later point
// so that stack traces will be more sensible.
log.Panic("appengine: NewContext passed an unknown http.Request")
}
return withContext(parent, c)
func ReqContext(req *http.Request) netcontext.Context {
return req.Context()
}
func BackgroundContext() netcontext.Context {
ctxs.Lock()
defer ctxs.Unlock()
if ctxs.bg != nil {
return toContext(ctxs.bg)
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context {
return jointContext{
base: parent,
valuesOnly: req.Context(),
}
}
// Compute background security ticket.
// DefaultTicket returns a ticket used for background context or dev_appserver.
func DefaultTicket() string {
defaultTicketOnce.Do(func() {
if IsDevAppServer() {
defaultTicket = "testapp" + defaultTicketSuffix
return
}
appID := partitionlessAppID()
escAppID := strings.Replace(strings.Replace(appID, ":", "_", -1), ".", "_", -1)
majVersion := VersionID(nil)
if i := strings.Index(majVersion, "."); i > 0 {
majVersion = majVersion[:i]
}
ticket := fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID())
defaultTicket = fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID())
})
return defaultTicket
}
ctxs.bg = &context{
func BackgroundContext() netcontext.Context {
backgroundContextOnce.Do(func() {
// Compute background security ticket.
ticket := DefaultTicket()
c := &context{
req: &http.Request{
Header: http.Header{
ticketHeader: []string{ticket},
@ -291,42 +306,28 @@ func BackgroundContext() netcontext.Context {
},
apiURL: apiURL(),
}
backgroundContext = toContext(c)
// TODO(dsymonds): Wire up the shutdown handler to do a final flush.
go ctxs.bg.logFlusher(make(chan int))
go c.logFlusher(make(chan int))
})
return toContext(ctxs.bg)
return backgroundContext
}
// RegisterTestRequest registers the HTTP request req for testing, such that
// any API calls are sent to the provided URL. It returns a closure to delete
// the registration.
// It should only be used by aetest package.
func RegisterTestRequest(req *http.Request, apiURL *url.URL, decorate func(netcontext.Context) netcontext.Context) func() {
func RegisterTestRequest(req *http.Request, apiURL *url.URL, decorate func(netcontext.Context) netcontext.Context) (*http.Request, func()) {
c := &context{
req: req,
apiURL: apiURL,
}
ctxs.Lock()
defer ctxs.Unlock()
if _, ok := ctxs.m[req]; ok {
log.Panic("req already associated with context")
}
if _, ok := ctxs.dec[req]; ok {
log.Panic("req already associated with context")
}
if ctxs.dec == nil {
ctxs.dec = make(map[*http.Request]func(netcontext.Context) netcontext.Context)
}
ctxs.m[req] = c
ctxs.dec[req] = decorate
return func() {
ctxs.Lock()
delete(ctxs.m, req)
delete(ctxs.dec, req)
ctxs.Unlock()
}
ctx := withContext(decorate(req.Context()), c)
req = req.WithContext(ctx)
c.req = req
return req, func() {}
}
var errTimeout = &CallError{
@ -452,7 +453,7 @@ func Call(ctx netcontext.Context, service, method string, in, out proto.Message)
c := fromContext(ctx)
if c == nil {
// Give a good error message rather than a panic lower down.
return errors.New("not an App Engine context")
return errNotAppEngineContext
}
// Apply transaction modifications if we're in a transaction.
@ -475,6 +476,16 @@ func Call(ctx netcontext.Context, service, method string, in, out proto.Message)
}
ticket := c.req.Header.Get(ticketHeader)
// Use a test ticket under test environment.
if ticket == "" {
if appid := ctx.Value(&appIDOverrideKey); appid != nil {
ticket = appid.(string) + defaultTicketSuffix
}
}
// Fall back to use background ticket when the request ticket is not available in Flex or dev_appserver.
if ticket == "" {
ticket = DefaultTicket()
}
req := &remotepb.Request{
ServiceName: &service,
Method: &method,
@ -550,6 +561,9 @@ var logLevelName = map[int64]string{
}
func logf(c *context, level int64, format string, args ...interface{}) {
if c == nil {
panic("not an App Engine context")
}
s := fmt.Sprintf(format, args...)
s = strings.TrimRight(s, "\n") // Remove any trailing newline characters.
c.addLogLine(&logpb.UserAppLogLine{

View File

@ -22,14 +22,20 @@ import (
var contextKey = "holds an appengine.Context"
// fromContext returns the App Engine context or nil if ctx is not
// derived from an App Engine context.
func fromContext(ctx netcontext.Context) appengine.Context {
c, _ := ctx.Value(&contextKey).(appengine.Context)
return c
}
// This is only for classic App Engine adapters.
func ClassicContextFromContext(ctx netcontext.Context) appengine.Context {
return fromContext(ctx)
func ClassicContextFromContext(ctx netcontext.Context) (appengine.Context, error) {
c := fromContext(ctx)
if c == nil {
return nil, errNotAppEngineContext
}
return c, nil
}
func withContext(parent netcontext.Context, c appengine.Context) netcontext.Context {
@ -53,6 +59,10 @@ func IncomingHeaders(ctx netcontext.Context) http.Header {
return nil
}
func ReqContext(req *http.Request) netcontext.Context {
return WithContext(netcontext.Background(), req)
}
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context {
c := appengine.NewContext(req)
return withContext(parent, c)
@ -98,7 +108,7 @@ func Call(ctx netcontext.Context, service, method string, in, out proto.Message)
c := fromContext(ctx)
if c == nil {
// Give a good error message rather than a panic lower down.
return errors.New("not an App Engine context")
return errNotAppEngineContext
}
// Apply transaction modifications if we're in a transaction.

View File

@ -5,10 +5,15 @@
package internal
import (
"errors"
"os"
"github.com/golang/protobuf/proto"
netcontext "golang.org/x/net/context"
)
var errNotAppEngineContext = errors.New("not an App Engine context")
type CallOverrideFunc func(ctx netcontext.Context, service, method string, in, out proto.Message) error
var callOverrideKey = "holds []CallOverrideFunc"
@ -77,10 +82,42 @@ func Logf(ctx netcontext.Context, level int64, format string, args ...interface{
f(level, format, args...)
return
}
logf(fromContext(ctx), level, format, args...)
c := fromContext(ctx)
if c == nil {
panic(errNotAppEngineContext)
}
logf(c, level, format, args...)
}
// NamespacedContext wraps a Context to support namespaces.
func NamespacedContext(ctx netcontext.Context, namespace string) netcontext.Context {
return withNamespace(ctx, namespace)
}
// SetTestEnv sets the env variables for testing background ticket in Flex.
func SetTestEnv() func() {
var environ = []struct {
key, value string
}{
{"GAE_LONG_APP_ID", "my-app-id"},
{"GAE_MINOR_VERSION", "067924799508853122"},
{"GAE_MODULE_INSTANCE", "0"},
{"GAE_MODULE_NAME", "default"},
{"GAE_MODULE_VERSION", "20150612t184001"},
}
for _, v := range environ {
old := os.Getenv(v.key)
os.Setenv(v.key, v.value)
v.value = old
}
return func() { // Restore old environment after the test completes.
for _, v := range environ {
if v.value == "" {
os.Unsetenv(v.key)
continue
}
os.Setenv(v.key, v.value)
}
}
}

View File

@ -0,0 +1,682 @@
// Copyright 2011 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// +build !appengine
// +build !go1.7
package internal
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"os"
"runtime"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/golang/protobuf/proto"
netcontext "golang.org/x/net/context"
basepb "google.golang.org/appengine/internal/base"
logpb "google.golang.org/appengine/internal/log"
remotepb "google.golang.org/appengine/internal/remote_api"
)
const (
apiPath = "/rpc_http"
defaultTicketSuffix = "/default.20150612t184001.0"
)
var (
// Incoming headers.
ticketHeader = http.CanonicalHeaderKey("X-AppEngine-API-Ticket")
dapperHeader = http.CanonicalHeaderKey("X-Google-DapperTraceInfo")
traceHeader = http.CanonicalHeaderKey("X-Cloud-Trace-Context")
curNamespaceHeader = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace")
userIPHeader = http.CanonicalHeaderKey("X-AppEngine-User-IP")
remoteAddrHeader = http.CanonicalHeaderKey("X-AppEngine-Remote-Addr")
// Outgoing headers.
apiEndpointHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Endpoint")
apiEndpointHeaderValue = []string{"app-engine-apis"}
apiMethodHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Method")
apiMethodHeaderValue = []string{"/VMRemoteAPI.CallRemoteAPI"}
apiDeadlineHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Deadline")
apiContentType = http.CanonicalHeaderKey("Content-Type")
apiContentTypeValue = []string{"application/octet-stream"}
logFlushHeader = http.CanonicalHeaderKey("X-AppEngine-Log-Flush-Count")
apiHTTPClient = &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: limitDial,
},
}
defaultTicketOnce sync.Once
defaultTicket string
)
func apiURL() *url.URL {
host, port := "appengine.googleapis.internal", "10001"
if h := os.Getenv("API_HOST"); h != "" {
host = h
}
if p := os.Getenv("API_PORT"); p != "" {
port = p
}
return &url.URL{
Scheme: "http",
Host: host + ":" + port,
Path: apiPath,
}
}
func handleHTTP(w http.ResponseWriter, r *http.Request) {
c := &context{
req: r,
outHeader: w.Header(),
apiURL: apiURL(),
}
stopFlushing := make(chan int)
ctxs.Lock()
ctxs.m[r] = c
ctxs.Unlock()
defer func() {
ctxs.Lock()
delete(ctxs.m, r)
ctxs.Unlock()
}()
// Patch up RemoteAddr so it looks reasonable.
if addr := r.Header.Get(userIPHeader); addr != "" {
r.RemoteAddr = addr
} else if addr = r.Header.Get(remoteAddrHeader); addr != "" {
r.RemoteAddr = addr
} else {
// Should not normally reach here, but pick a sensible default anyway.
r.RemoteAddr = "127.0.0.1"
}
// The address in the headers will most likely be of these forms:
// 123.123.123.123
// 2001:db8::1
// net/http.Request.RemoteAddr is specified to be in "IP:port" form.
if _, _, err := net.SplitHostPort(r.RemoteAddr); err != nil {
// Assume the remote address is only a host; add a default port.
r.RemoteAddr = net.JoinHostPort(r.RemoteAddr, "80")
}
// Start goroutine responsible for flushing app logs.
// This is done after adding c to ctx.m (and stopped before removing it)
// because flushing logs requires making an API call.
go c.logFlusher(stopFlushing)
executeRequestSafely(c, r)
c.outHeader = nil // make sure header changes aren't respected any more
stopFlushing <- 1 // any logging beyond this point will be dropped
// Flush any pending logs asynchronously.
c.pendingLogs.Lock()
flushes := c.pendingLogs.flushes
if len(c.pendingLogs.lines) > 0 {
flushes++
}
c.pendingLogs.Unlock()
go c.flushLog(false)
w.Header().Set(logFlushHeader, strconv.Itoa(flushes))
// Avoid nil Write call if c.Write is never called.
if c.outCode != 0 {
w.WriteHeader(c.outCode)
}
if c.outBody != nil {
w.Write(c.outBody)
}
}
func executeRequestSafely(c *context, r *http.Request) {
defer func() {
if x := recover(); x != nil {
logf(c, 4, "%s", renderPanic(x)) // 4 == critical
c.outCode = 500
}
}()
http.DefaultServeMux.ServeHTTP(c, r)
}
func renderPanic(x interface{}) string {
buf := make([]byte, 16<<10) // 16 KB should be plenty
buf = buf[:runtime.Stack(buf, false)]
// Remove the first few stack frames:
// this func
// the recover closure in the caller
// That will root the stack trace at the site of the panic.
const (
skipStart = "internal.renderPanic"
skipFrames = 2
)
start := bytes.Index(buf, []byte(skipStart))
p := start
for i := 0; i < skipFrames*2 && p+1 < len(buf); i++ {
p = bytes.IndexByte(buf[p+1:], '\n') + p + 1
if p < 0 {
break
}
}
if p >= 0 {
// buf[start:p+1] is the block to remove.
// Copy buf[p+1:] over buf[start:] and shrink buf.
copy(buf[start:], buf[p+1:])
buf = buf[:len(buf)-(p+1-start)]
}
// Add panic heading.
head := fmt.Sprintf("panic: %v\n\n", x)
if len(head) > len(buf) {
// Extremely unlikely to happen.
return head
}
copy(buf[len(head):], buf)
copy(buf, head)
return string(buf)
}
var ctxs = struct {
sync.Mutex
m map[*http.Request]*context
bg *context // background context, lazily initialized
// dec is used by tests to decorate the netcontext.Context returned
// for a given request. This allows tests to add overrides (such as
// WithAppIDOverride) to the context. The map is nil outside tests.
dec map[*http.Request]func(netcontext.Context) netcontext.Context
}{
m: make(map[*http.Request]*context),
}
// context represents the context of an in-flight HTTP request.
// It implements the appengine.Context and http.ResponseWriter interfaces.
type context struct {
req *http.Request
outCode int
outHeader http.Header
outBody []byte
pendingLogs struct {
sync.Mutex
lines []*logpb.UserAppLogLine
flushes int
}
apiURL *url.URL
}
var contextKey = "holds a *context"
// fromContext returns the App Engine context or nil if ctx is not
// derived from an App Engine context.
func fromContext(ctx netcontext.Context) *context {
c, _ := ctx.Value(&contextKey).(*context)
return c
}
func withContext(parent netcontext.Context, c *context) netcontext.Context {
ctx := netcontext.WithValue(parent, &contextKey, c)
if ns := c.req.Header.Get(curNamespaceHeader); ns != "" {
ctx = withNamespace(ctx, ns)
}
return ctx
}
func toContext(c *context) netcontext.Context {
return withContext(netcontext.Background(), c)
}
func IncomingHeaders(ctx netcontext.Context) http.Header {
if c := fromContext(ctx); c != nil {
return c.req.Header
}
return nil
}
func ReqContext(req *http.Request) netcontext.Context {
return WithContext(netcontext.Background(), req)
}
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context {
ctxs.Lock()
c := ctxs.m[req]
d := ctxs.dec[req]
ctxs.Unlock()
if d != nil {
parent = d(parent)
}
if c == nil {
// Someone passed in an http.Request that is not in-flight.
// We panic here rather than panicking at a later point
// so that stack traces will be more sensible.
log.Panic("appengine: NewContext passed an unknown http.Request")
}
return withContext(parent, c)
}
// DefaultTicket returns a ticket used for background context or dev_appserver.
func DefaultTicket() string {
defaultTicketOnce.Do(func() {
if IsDevAppServer() {
defaultTicket = "testapp" + defaultTicketSuffix
return
}
appID := partitionlessAppID()
escAppID := strings.Replace(strings.Replace(appID, ":", "_", -1), ".", "_", -1)
majVersion := VersionID(nil)
if i := strings.Index(majVersion, "."); i > 0 {
majVersion = majVersion[:i]
}
defaultTicket = fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID())
})
return defaultTicket
}
func BackgroundContext() netcontext.Context {
ctxs.Lock()
defer ctxs.Unlock()
if ctxs.bg != nil {
return toContext(ctxs.bg)
}
// Compute background security ticket.
ticket := DefaultTicket()
ctxs.bg = &context{
req: &http.Request{
Header: http.Header{
ticketHeader: []string{ticket},
},
},
apiURL: apiURL(),
}
// TODO(dsymonds): Wire up the shutdown handler to do a final flush.
go ctxs.bg.logFlusher(make(chan int))
return toContext(ctxs.bg)
}
// RegisterTestRequest registers the HTTP request req for testing, such that
// any API calls are sent to the provided URL. It returns a closure to delete
// the registration.
// It should only be used by aetest package.
func RegisterTestRequest(req *http.Request, apiURL *url.URL, decorate func(netcontext.Context) netcontext.Context) (*http.Request, func()) {
c := &context{
req: req,
apiURL: apiURL,
}
ctxs.Lock()
defer ctxs.Unlock()
if _, ok := ctxs.m[req]; ok {
log.Panic("req already associated with context")
}
if _, ok := ctxs.dec[req]; ok {
log.Panic("req already associated with context")
}
if ctxs.dec == nil {
ctxs.dec = make(map[*http.Request]func(netcontext.Context) netcontext.Context)
}
ctxs.m[req] = c
ctxs.dec[req] = decorate
return req, func() {
ctxs.Lock()
delete(ctxs.m, req)
delete(ctxs.dec, req)
ctxs.Unlock()
}
}
var errTimeout = &CallError{
Detail: "Deadline exceeded",
Code: int32(remotepb.RpcError_CANCELLED),
Timeout: true,
}
func (c *context) Header() http.Header { return c.outHeader }
// Copied from $GOROOT/src/pkg/net/http/transfer.go. Some response status
// codes do not permit a response body (nor response entity headers such as
// Content-Length, Content-Type, etc).
func bodyAllowedForStatus(status int) bool {
switch {
case status >= 100 && status <= 199:
return false
case status == 204:
return false
case status == 304:
return false
}
return true
}
func (c *context) Write(b []byte) (int, error) {
if c.outCode == 0 {
c.WriteHeader(http.StatusOK)
}
if len(b) > 0 && !bodyAllowedForStatus(c.outCode) {
return 0, http.ErrBodyNotAllowed
}
c.outBody = append(c.outBody, b...)
return len(b), nil
}
func (c *context) WriteHeader(code int) {
if c.outCode != 0 {
logf(c, 3, "WriteHeader called multiple times on request.") // error level
return
}
c.outCode = code
}
func (c *context) post(body []byte, timeout time.Duration) (b []byte, err error) {
hreq := &http.Request{
Method: "POST",
URL: c.apiURL,
Header: http.Header{
apiEndpointHeader: apiEndpointHeaderValue,
apiMethodHeader: apiMethodHeaderValue,
apiContentType: apiContentTypeValue,
apiDeadlineHeader: []string{strconv.FormatFloat(timeout.Seconds(), 'f', -1, 64)},
},
Body: ioutil.NopCloser(bytes.NewReader(body)),
ContentLength: int64(len(body)),
Host: c.apiURL.Host,
}
if info := c.req.Header.Get(dapperHeader); info != "" {
hreq.Header.Set(dapperHeader, info)
}
if info := c.req.Header.Get(traceHeader); info != "" {
hreq.Header.Set(traceHeader, info)
}
tr := apiHTTPClient.Transport.(*http.Transport)
var timedOut int32 // atomic; set to 1 if timed out
t := time.AfterFunc(timeout, func() {
atomic.StoreInt32(&timedOut, 1)
tr.CancelRequest(hreq)
})
defer t.Stop()
defer func() {
// Check if timeout was exceeded.
if atomic.LoadInt32(&timedOut) != 0 {
err = errTimeout
}
}()
hresp, err := apiHTTPClient.Do(hreq)
if err != nil {
return nil, &CallError{
Detail: fmt.Sprintf("service bridge HTTP failed: %v", err),
Code: int32(remotepb.RpcError_UNKNOWN),
}
}
defer hresp.Body.Close()
hrespBody, err := ioutil.ReadAll(hresp.Body)
if hresp.StatusCode != 200 {
return nil, &CallError{
Detail: fmt.Sprintf("service bridge returned HTTP %d (%q)", hresp.StatusCode, hrespBody),
Code: int32(remotepb.RpcError_UNKNOWN),
}
}
if err != nil {
return nil, &CallError{
Detail: fmt.Sprintf("service bridge response bad: %v", err),
Code: int32(remotepb.RpcError_UNKNOWN),
}
}
return hrespBody, nil
}
func Call(ctx netcontext.Context, service, method string, in, out proto.Message) error {
if ns := NamespaceFromContext(ctx); ns != "" {
if fn, ok := NamespaceMods[service]; ok {
fn(in, ns)
}
}
if f, ctx, ok := callOverrideFromContext(ctx); ok {
return f(ctx, service, method, in, out)
}
// Handle already-done contexts quickly.
select {
case <-ctx.Done():
return ctx.Err()
default:
}
c := fromContext(ctx)
if c == nil {
// Give a good error message rather than a panic lower down.
return errNotAppEngineContext
}
// Apply transaction modifications if we're in a transaction.
if t := transactionFromContext(ctx); t != nil {
if t.finished {
return errors.New("transaction context has expired")
}
applyTransaction(in, &t.transaction)
}
// Default RPC timeout is 60s.
timeout := 60 * time.Second
if deadline, ok := ctx.Deadline(); ok {
timeout = deadline.Sub(time.Now())
}
data, err := proto.Marshal(in)
if err != nil {
return err
}
ticket := c.req.Header.Get(ticketHeader)
// Use a test ticket under test environment.
if ticket == "" {
if appid := ctx.Value(&appIDOverrideKey); appid != nil {
ticket = appid.(string) + defaultTicketSuffix
}
}
// Fall back to use background ticket when the request ticket is not available in Flex or dev_appserver.
if ticket == "" {
ticket = DefaultTicket()
}
req := &remotepb.Request{
ServiceName: &service,
Method: &method,
Request: data,
RequestId: &ticket,
}
hreqBody, err := proto.Marshal(req)
if err != nil {
return err
}
hrespBody, err := c.post(hreqBody, timeout)
if err != nil {
return err
}
res := &remotepb.Response{}
if err := proto.Unmarshal(hrespBody, res); err != nil {
return err
}
if res.RpcError != nil {
ce := &CallError{
Detail: res.RpcError.GetDetail(),
Code: *res.RpcError.Code,
}
switch remotepb.RpcError_ErrorCode(ce.Code) {
case remotepb.RpcError_CANCELLED, remotepb.RpcError_DEADLINE_EXCEEDED:
ce.Timeout = true
}
return ce
}
if res.ApplicationError != nil {
return &APIError{
Service: *req.ServiceName,
Detail: res.ApplicationError.GetDetail(),
Code: *res.ApplicationError.Code,
}
}
if res.Exception != nil || res.JavaException != nil {
// This shouldn't happen, but let's be defensive.
return &CallError{
Detail: "service bridge returned exception",
Code: int32(remotepb.RpcError_UNKNOWN),
}
}
return proto.Unmarshal(res.Response, out)
}
func (c *context) Request() *http.Request {
return c.req
}
func (c *context) addLogLine(ll *logpb.UserAppLogLine) {
// Truncate long log lines.
// TODO(dsymonds): Check if this is still necessary.
const lim = 8 << 10
if len(*ll.Message) > lim {
suffix := fmt.Sprintf("...(length %d)", len(*ll.Message))
ll.Message = proto.String((*ll.Message)[:lim-len(suffix)] + suffix)
}
c.pendingLogs.Lock()
c.pendingLogs.lines = append(c.pendingLogs.lines, ll)
c.pendingLogs.Unlock()
}
var logLevelName = map[int64]string{
0: "DEBUG",
1: "INFO",
2: "WARNING",
3: "ERROR",
4: "CRITICAL",
}
func logf(c *context, level int64, format string, args ...interface{}) {
if c == nil {
panic("not an App Engine context")
}
s := fmt.Sprintf(format, args...)
s = strings.TrimRight(s, "\n") // Remove any trailing newline characters.
c.addLogLine(&logpb.UserAppLogLine{
TimestampUsec: proto.Int64(time.Now().UnixNano() / 1e3),
Level: &level,
Message: &s,
})
log.Print(logLevelName[level] + ": " + s)
}
// flushLog attempts to flush any pending logs to the appserver.
// It should not be called concurrently.
func (c *context) flushLog(force bool) (flushed bool) {
c.pendingLogs.Lock()
// Grab up to 30 MB. We can get away with up to 32 MB, but let's be cautious.
n, rem := 0, 30<<20
for ; n < len(c.pendingLogs.lines); n++ {
ll := c.pendingLogs.lines[n]
// Each log line will require about 3 bytes of overhead.
nb := proto.Size(ll) + 3
if nb > rem {
break
}
rem -= nb
}
lines := c.pendingLogs.lines[:n]
c.pendingLogs.lines = c.pendingLogs.lines[n:]
c.pendingLogs.Unlock()
if len(lines) == 0 && !force {
// Nothing to flush.
return false
}
rescueLogs := false
defer func() {
if rescueLogs {
c.pendingLogs.Lock()
c.pendingLogs.lines = append(lines, c.pendingLogs.lines...)
c.pendingLogs.Unlock()
}
}()
buf, err := proto.Marshal(&logpb.UserAppLogGroup{
LogLine: lines,
})
if err != nil {
log.Printf("internal.flushLog: marshaling UserAppLogGroup: %v", err)
rescueLogs = true
return false
}
req := &logpb.FlushRequest{
Logs: buf,
}
res := &basepb.VoidProto{}
c.pendingLogs.Lock()
c.pendingLogs.flushes++
c.pendingLogs.Unlock()
if err := Call(toContext(c), "logservice", "Flush", req, res); err != nil {
log.Printf("internal.flushLog: Flush RPC: %v", err)
rescueLogs = true
return false
}
return true
}
const (
// Log flushing parameters.
flushInterval = 1 * time.Second
forceFlushInterval = 60 * time.Second
)
func (c *context) logFlusher(stop <-chan int) {
lastFlush := time.Now()
tick := time.NewTicker(flushInterval)
for {
select {
case <-stop:
// Request finished.
tick.Stop()
return
case <-tick.C:
force := time.Now().Sub(lastFlush) > forceFlushInterval
if c.flushLog(force) {
lastFlush = time.Now()
}
}
}
}
func ContextForTesting(req *http.Request) netcontext.Context {
return toContext(&context{req: req})
}

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google.golang.org/appengine/internal/app_identity/app_identity_service.proto
// DO NOT EDIT!
/*
Package app_identity is a generated protocol buffer package.
@ -33,6 +32,12 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AppIdentityServiceError_ErrorCode int32
const (
@ -83,6 +88,9 @@ func (x *AppIdentityServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
*x = AppIdentityServiceError_ErrorCode(value)
return nil
}
func (AppIdentityServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{0, 0}
}
type AppIdentityServiceError struct {
XXX_unrecognized []byte `json:"-"`
@ -91,15 +99,17 @@ type AppIdentityServiceError struct {
func (m *AppIdentityServiceError) Reset() { *m = AppIdentityServiceError{} }
func (m *AppIdentityServiceError) String() string { return proto.CompactTextString(m) }
func (*AppIdentityServiceError) ProtoMessage() {}
func (*AppIdentityServiceError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type SignForAppRequest struct {
BytesToSign []byte `protobuf:"bytes,1,opt,name=bytes_to_sign" json:"bytes_to_sign,omitempty"`
BytesToSign []byte `protobuf:"bytes,1,opt,name=bytes_to_sign,json=bytesToSign" json:"bytes_to_sign,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *SignForAppRequest) Reset() { *m = SignForAppRequest{} }
func (m *SignForAppRequest) String() string { return proto.CompactTextString(m) }
func (*SignForAppRequest) ProtoMessage() {}
func (*SignForAppRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *SignForAppRequest) GetBytesToSign() []byte {
if m != nil {
@ -109,14 +119,15 @@ func (m *SignForAppRequest) GetBytesToSign() []byte {
}
type SignForAppResponse struct {
KeyName *string `protobuf:"bytes,1,opt,name=key_name" json:"key_name,omitempty"`
SignatureBytes []byte `protobuf:"bytes,2,opt,name=signature_bytes" json:"signature_bytes,omitempty"`
KeyName *string `protobuf:"bytes,1,opt,name=key_name,json=keyName" json:"key_name,omitempty"`
SignatureBytes []byte `protobuf:"bytes,2,opt,name=signature_bytes,json=signatureBytes" json:"signature_bytes,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *SignForAppResponse) Reset() { *m = SignForAppResponse{} }
func (m *SignForAppResponse) String() string { return proto.CompactTextString(m) }
func (*SignForAppResponse) ProtoMessage() {}
func (*SignForAppResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *SignForAppResponse) GetKeyName() string {
if m != nil && m.KeyName != nil {
@ -139,16 +150,20 @@ type GetPublicCertificateForAppRequest struct {
func (m *GetPublicCertificateForAppRequest) Reset() { *m = GetPublicCertificateForAppRequest{} }
func (m *GetPublicCertificateForAppRequest) String() string { return proto.CompactTextString(m) }
func (*GetPublicCertificateForAppRequest) ProtoMessage() {}
func (*GetPublicCertificateForAppRequest) Descriptor() ([]byte, []int) {
return fileDescriptor0, []int{3}
}
type PublicCertificate struct {
KeyName *string `protobuf:"bytes,1,opt,name=key_name" json:"key_name,omitempty"`
X509CertificatePem *string `protobuf:"bytes,2,opt,name=x509_certificate_pem" json:"x509_certificate_pem,omitempty"`
KeyName *string `protobuf:"bytes,1,opt,name=key_name,json=keyName" json:"key_name,omitempty"`
X509CertificatePem *string `protobuf:"bytes,2,opt,name=x509_certificate_pem,json=x509CertificatePem" json:"x509_certificate_pem,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *PublicCertificate) Reset() { *m = PublicCertificate{} }
func (m *PublicCertificate) String() string { return proto.CompactTextString(m) }
func (*PublicCertificate) ProtoMessage() {}
func (*PublicCertificate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *PublicCertificate) GetKeyName() string {
if m != nil && m.KeyName != nil {
@ -165,14 +180,17 @@ func (m *PublicCertificate) GetX509CertificatePem() string {
}
type GetPublicCertificateForAppResponse struct {
PublicCertificateList []*PublicCertificate `protobuf:"bytes,1,rep,name=public_certificate_list" json:"public_certificate_list,omitempty"`
MaxClientCacheTimeInSecond *int64 `protobuf:"varint,2,opt,name=max_client_cache_time_in_second" json:"max_client_cache_time_in_second,omitempty"`
PublicCertificateList []*PublicCertificate `protobuf:"bytes,1,rep,name=public_certificate_list,json=publicCertificateList" json:"public_certificate_list,omitempty"`
MaxClientCacheTimeInSecond *int64 `protobuf:"varint,2,opt,name=max_client_cache_time_in_second,json=maxClientCacheTimeInSecond" json:"max_client_cache_time_in_second,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *GetPublicCertificateForAppResponse) Reset() { *m = GetPublicCertificateForAppResponse{} }
func (m *GetPublicCertificateForAppResponse) String() string { return proto.CompactTextString(m) }
func (*GetPublicCertificateForAppResponse) ProtoMessage() {}
func (*GetPublicCertificateForAppResponse) Descriptor() ([]byte, []int) {
return fileDescriptor0, []int{5}
}
func (m *GetPublicCertificateForAppResponse) GetPublicCertificateList() []*PublicCertificate {
if m != nil {
@ -195,15 +213,17 @@ type GetServiceAccountNameRequest struct {
func (m *GetServiceAccountNameRequest) Reset() { *m = GetServiceAccountNameRequest{} }
func (m *GetServiceAccountNameRequest) String() string { return proto.CompactTextString(m) }
func (*GetServiceAccountNameRequest) ProtoMessage() {}
func (*GetServiceAccountNameRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
type GetServiceAccountNameResponse struct {
ServiceAccountName *string `protobuf:"bytes,1,opt,name=service_account_name" json:"service_account_name,omitempty"`
ServiceAccountName *string `protobuf:"bytes,1,opt,name=service_account_name,json=serviceAccountName" json:"service_account_name,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *GetServiceAccountNameResponse) Reset() { *m = GetServiceAccountNameResponse{} }
func (m *GetServiceAccountNameResponse) String() string { return proto.CompactTextString(m) }
func (*GetServiceAccountNameResponse) ProtoMessage() {}
func (*GetServiceAccountNameResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *GetServiceAccountNameResponse) GetServiceAccountName() string {
if m != nil && m.ServiceAccountName != nil {
@ -214,14 +234,15 @@ func (m *GetServiceAccountNameResponse) GetServiceAccountName() string {
type GetAccessTokenRequest struct {
Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"`
ServiceAccountId *int64 `protobuf:"varint,2,opt,name=service_account_id" json:"service_account_id,omitempty"`
ServiceAccountName *string `protobuf:"bytes,3,opt,name=service_account_name" json:"service_account_name,omitempty"`
ServiceAccountId *int64 `protobuf:"varint,2,opt,name=service_account_id,json=serviceAccountId" json:"service_account_id,omitempty"`
ServiceAccountName *string `protobuf:"bytes,3,opt,name=service_account_name,json=serviceAccountName" json:"service_account_name,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *GetAccessTokenRequest) Reset() { *m = GetAccessTokenRequest{} }
func (m *GetAccessTokenRequest) String() string { return proto.CompactTextString(m) }
func (*GetAccessTokenRequest) ProtoMessage() {}
func (*GetAccessTokenRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *GetAccessTokenRequest) GetScope() []string {
if m != nil {
@ -245,14 +266,15 @@ func (m *GetAccessTokenRequest) GetServiceAccountName() string {
}
type GetAccessTokenResponse struct {
AccessToken *string `protobuf:"bytes,1,opt,name=access_token" json:"access_token,omitempty"`
ExpirationTime *int64 `protobuf:"varint,2,opt,name=expiration_time" json:"expiration_time,omitempty"`
AccessToken *string `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"`
ExpirationTime *int64 `protobuf:"varint,2,opt,name=expiration_time,json=expirationTime" json:"expiration_time,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *GetAccessTokenResponse) Reset() { *m = GetAccessTokenResponse{} }
func (m *GetAccessTokenResponse) String() string { return proto.CompactTextString(m) }
func (*GetAccessTokenResponse) ProtoMessage() {}
func (*GetAccessTokenResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *GetAccessTokenResponse) GetAccessToken() string {
if m != nil && m.AccessToken != nil {
@ -275,15 +297,19 @@ type GetDefaultGcsBucketNameRequest struct {
func (m *GetDefaultGcsBucketNameRequest) Reset() { *m = GetDefaultGcsBucketNameRequest{} }
func (m *GetDefaultGcsBucketNameRequest) String() string { return proto.CompactTextString(m) }
func (*GetDefaultGcsBucketNameRequest) ProtoMessage() {}
func (*GetDefaultGcsBucketNameRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
type GetDefaultGcsBucketNameResponse struct {
DefaultGcsBucketName *string `protobuf:"bytes,1,opt,name=default_gcs_bucket_name" json:"default_gcs_bucket_name,omitempty"`
DefaultGcsBucketName *string `protobuf:"bytes,1,opt,name=default_gcs_bucket_name,json=defaultGcsBucketName" json:"default_gcs_bucket_name,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *GetDefaultGcsBucketNameResponse) Reset() { *m = GetDefaultGcsBucketNameResponse{} }
func (m *GetDefaultGcsBucketNameResponse) String() string { return proto.CompactTextString(m) }
func (*GetDefaultGcsBucketNameResponse) ProtoMessage() {}
func (*GetDefaultGcsBucketNameResponse) Descriptor() ([]byte, []int) {
return fileDescriptor0, []int{11}
}
func (m *GetDefaultGcsBucketNameResponse) GetDefaultGcsBucketName() string {
if m != nil && m.DefaultGcsBucketName != nil {
@ -293,4 +319,67 @@ func (m *GetDefaultGcsBucketNameResponse) GetDefaultGcsBucketName() string {
}
func init() {
proto.RegisterType((*AppIdentityServiceError)(nil), "appengine.AppIdentityServiceError")
proto.RegisterType((*SignForAppRequest)(nil), "appengine.SignForAppRequest")
proto.RegisterType((*SignForAppResponse)(nil), "appengine.SignForAppResponse")
proto.RegisterType((*GetPublicCertificateForAppRequest)(nil), "appengine.GetPublicCertificateForAppRequest")
proto.RegisterType((*PublicCertificate)(nil), "appengine.PublicCertificate")
proto.RegisterType((*GetPublicCertificateForAppResponse)(nil), "appengine.GetPublicCertificateForAppResponse")
proto.RegisterType((*GetServiceAccountNameRequest)(nil), "appengine.GetServiceAccountNameRequest")
proto.RegisterType((*GetServiceAccountNameResponse)(nil), "appengine.GetServiceAccountNameResponse")
proto.RegisterType((*GetAccessTokenRequest)(nil), "appengine.GetAccessTokenRequest")
proto.RegisterType((*GetAccessTokenResponse)(nil), "appengine.GetAccessTokenResponse")
proto.RegisterType((*GetDefaultGcsBucketNameRequest)(nil), "appengine.GetDefaultGcsBucketNameRequest")
proto.RegisterType((*GetDefaultGcsBucketNameResponse)(nil), "appengine.GetDefaultGcsBucketNameResponse")
}
func init() {
proto.RegisterFile("google.golang.org/appengine/internal/app_identity/app_identity_service.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 676 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdb, 0x6e, 0xda, 0x58,
0x14, 0x1d, 0x26, 0x1a, 0x31, 0x6c, 0x12, 0x62, 0xce, 0x90, 0xcb, 0x8c, 0x32, 0xb9, 0x78, 0x1e,
0x26, 0x0f, 0x15, 0x89, 0x2a, 0x45, 0x55, 0x1f, 0x8d, 0xed, 0x22, 0x54, 0x07, 0x53, 0x43, 0x9a,
0xa8, 0x2f, 0xa7, 0xce, 0x61, 0xc7, 0x3d, 0x02, 0x9f, 0xe3, 0xda, 0x87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 0xfa, 0x21, 0xec, 0x37, 0x51, 0x59, 0x78, 0xe3, 0x8f, 0x86, 0xaa,
0xc9, 0x92, 0xc6, 0x88, 0x0d, 0x70, 0xa9, 0xea, 0x2b, 0x38, 0x58, 0xc9, 0xc8, 0x03, 0x9d, 0xc1,
0x4e, 0x7f, 0x3a, 0xa7, 0x01, 0x4b, 0xe8, 0x75, 0xc6, 0x58, 0xec, 0xbb, 0xd6, 0xff, 0x85, 0xbc,
0x51, 0x79, 0xb5, 0xbe, 0xf8, 0xc9, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0x37, 0x4c, 0x56, 0x38,
0xf3, 0x04, 0x00, 0x00,
}

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google.golang.org/appengine/internal/base/api_base.proto
// DO NOT EDIT!
/*
Package base is a generated protocol buffer package.
@ -28,6 +27,12 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type StringProto struct {
Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"`
XXX_unrecognized []byte `json:"-"`
@ -36,6 +41,7 @@ type StringProto struct {
func (m *StringProto) Reset() { *m = StringProto{} }
func (m *StringProto) String() string { return proto.CompactTextString(m) }
func (*StringProto) ProtoMessage() {}
func (*StringProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *StringProto) GetValue() string {
if m != nil && m.Value != nil {
@ -52,6 +58,7 @@ type Integer32Proto struct {
func (m *Integer32Proto) Reset() { *m = Integer32Proto{} }
func (m *Integer32Proto) String() string { return proto.CompactTextString(m) }
func (*Integer32Proto) ProtoMessage() {}
func (*Integer32Proto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *Integer32Proto) GetValue() int32 {
if m != nil && m.Value != nil {
@ -68,6 +75,7 @@ type Integer64Proto struct {
func (m *Integer64Proto) Reset() { *m = Integer64Proto{} }
func (m *Integer64Proto) String() string { return proto.CompactTextString(m) }
func (*Integer64Proto) ProtoMessage() {}
func (*Integer64Proto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *Integer64Proto) GetValue() int64 {
if m != nil && m.Value != nil {
@ -84,6 +92,7 @@ type BoolProto struct {
func (m *BoolProto) Reset() { *m = BoolProto{} }
func (m *BoolProto) String() string { return proto.CompactTextString(m) }
func (*BoolProto) ProtoMessage() {}
func (*BoolProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *BoolProto) GetValue() bool {
if m != nil && m.Value != nil {
@ -100,6 +109,7 @@ type DoubleProto struct {
func (m *DoubleProto) Reset() { *m = DoubleProto{} }
func (m *DoubleProto) String() string { return proto.CompactTextString(m) }
func (*DoubleProto) ProtoMessage() {}
func (*DoubleProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *DoubleProto) GetValue() float64 {
if m != nil && m.Value != nil {
@ -116,6 +126,7 @@ type BytesProto struct {
func (m *BytesProto) Reset() { *m = BytesProto{} }
func (m *BytesProto) String() string { return proto.CompactTextString(m) }
func (*BytesProto) ProtoMessage() {}
func (*BytesProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *BytesProto) GetValue() []byte {
if m != nil {
@ -131,3 +142,35 @@ type VoidProto struct {
func (m *VoidProto) Reset() { *m = VoidProto{} }
func (m *VoidProto) String() string { return proto.CompactTextString(m) }
func (*VoidProto) ProtoMessage() {}
func (*VoidProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func init() {
proto.RegisterType((*StringProto)(nil), "appengine.base.StringProto")
proto.RegisterType((*Integer32Proto)(nil), "appengine.base.Integer32Proto")
proto.RegisterType((*Integer64Proto)(nil), "appengine.base.Integer64Proto")
proto.RegisterType((*BoolProto)(nil), "appengine.base.BoolProto")
proto.RegisterType((*DoubleProto)(nil), "appengine.base.DoubleProto")
proto.RegisterType((*BytesProto)(nil), "appengine.base.BytesProto")
proto.RegisterType((*VoidProto)(nil), "appengine.base.VoidProto")
}
func init() {
proto.RegisterFile("google.golang.org/appengine/internal/base/api_base.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 199 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xcf, 0x3f, 0x4b, 0xc6, 0x30,
0x10, 0x06, 0x70, 0x5a, 0xad, 0xb4, 0x57, 0xe9, 0x20, 0x0e, 0x1d, 0xb5, 0x05, 0x71, 0x4a, 0x40,
0x45, 0x9c, 0x83, 0x8b, 0x9b, 0x28, 0x38, 0xb8, 0x48, 0x8a, 0xc7, 0x11, 0x08, 0xb9, 0x90, 0xa6,
0x82, 0xdf, 0x5e, 0xda, 0xd2, 0xfa, 0xc2, 0x9b, 0xed, 0xfe, 0xfc, 0xe0, 0xe1, 0x81, 0x27, 0x62,
0x26, 0x8b, 0x82, 0xd8, 0x6a, 0x47, 0x82, 0x03, 0x49, 0xed, 0x3d, 0x3a, 0x32, 0x0e, 0xa5, 0x71,
0x11, 0x83, 0xd3, 0x56, 0x0e, 0x7a, 0x44, 0xa9, 0xbd, 0xf9, 0x9a, 0x07, 0xe1, 0x03, 0x47, 0xbe,
0x68, 0x76, 0x27, 0xe6, 0x6b, 0xd7, 0x43, 0xfd, 0x1e, 0x83, 0x71, 0xf4, 0xba, 0xbc, 0x2f, 0xa1,
0xf8, 0xd1, 0x76, 0xc2, 0x36, 0xbb, 0xca, 0x6f, 0xab, 0xb7, 0x75, 0xe9, 0x6e, 0xa0, 0x79, 0x71,
0x11, 0x09, 0xc3, 0xfd, 0x5d, 0xc2, 0x15, 0xc7, 0xee, 0xf1, 0x21, 0xe1, 0x4e, 0x36, 0x77, 0x0d,
0x95, 0x62, 0xb6, 0x09, 0x52, 0x6e, 0xa4, 0x87, 0xfa, 0x99, 0xa7, 0xc1, 0x62, 0x02, 0x65, 0xff,
0x79, 0xa0, 0x7e, 0x23, 0x8e, 0xab, 0x69, 0x0f, 0xcd, 0xb9, 0xca, 0xcb, 0xdd, 0xd5, 0x50, 0x7d,
0xb0, 0xf9, 0x5e, 0x98, 0x3a, 0xfb, 0x3c, 0x9d, 0x9b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xba,
0x37, 0x25, 0xea, 0x44, 0x01, 0x00, 0x00,
}

File diff suppressed because it is too large Load Diff

View File

@ -529,6 +529,16 @@ message BeginTransactionRequest {
required string app = 1;
optional bool allow_multiple_eg = 2 [default = false];
optional string database_id = 4;
enum TransactionMode {
UNKNOWN = 0;
READ_ONLY = 1;
READ_WRITE = 2;
}
optional TransactionMode mode = 5 [default = UNKNOWN];
optional Transaction previous_transaction = 7;
}
message CommitResponse {

View File

@ -13,15 +13,45 @@ import (
)
func DefaultVersionHostname(ctx netcontext.Context) string {
return appengine.DefaultVersionHostname(fromContext(ctx))
c := fromContext(ctx)
if c == nil {
panic(errNotAppEngineContext)
}
return appengine.DefaultVersionHostname(c)
}
func RequestID(ctx netcontext.Context) string { return appengine.RequestID(fromContext(ctx)) }
func Datacenter(_ netcontext.Context) string { return appengine.Datacenter() }
func ServerSoftware() string { return appengine.ServerSoftware() }
func ModuleName(ctx netcontext.Context) string { return appengine.ModuleName(fromContext(ctx)) }
func VersionID(ctx netcontext.Context) string { return appengine.VersionID(fromContext(ctx)) }
func InstanceID() string { return appengine.InstanceID() }
func IsDevAppServer() bool { return appengine.IsDevAppServer() }
func fullyQualifiedAppID(ctx netcontext.Context) string { return fromContext(ctx).FullyQualifiedAppID() }
func RequestID(ctx netcontext.Context) string {
c := fromContext(ctx)
if c == nil {
panic(errNotAppEngineContext)
}
return appengine.RequestID(c)
}
func ModuleName(ctx netcontext.Context) string {
c := fromContext(ctx)
if c == nil {
panic(errNotAppEngineContext)
}
return appengine.ModuleName(c)
}
func VersionID(ctx netcontext.Context) string {
c := fromContext(ctx)
if c == nil {
panic(errNotAppEngineContext)
}
return appengine.VersionID(c)
}
func fullyQualifiedAppID(ctx netcontext.Context) string {
c := fromContext(ctx)
if c == nil {
panic(errNotAppEngineContext)
}
return c.FullyQualifiedAppID()
}

View File

@ -23,7 +23,11 @@ const (
)
func ctxHeaders(ctx netcontext.Context) http.Header {
return fromContext(ctx).Request().Header
c := fromContext(ctx)
if c == nil {
return nil
}
return c.Request().Header
}
func DefaultVersionHostname(ctx netcontext.Context) string {

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google.golang.org/appengine/internal/log/log_service.proto
// DO NOT EDIT!
/*
Package log is a generated protocol buffer package.
@ -35,6 +34,12 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type LogServiceError_ErrorCode int32
const (
@ -70,6 +75,7 @@ func (x *LogServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
*x = LogServiceError_ErrorCode(value)
return nil
}
func (LogServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
type LogServiceError struct {
XXX_unrecognized []byte `json:"-"`
@ -78,9 +84,10 @@ type LogServiceError struct {
func (m *LogServiceError) Reset() { *m = LogServiceError{} }
func (m *LogServiceError) String() string { return proto.CompactTextString(m) }
func (*LogServiceError) ProtoMessage() {}
func (*LogServiceError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type UserAppLogLine struct {
TimestampUsec *int64 `protobuf:"varint,1,req,name=timestamp_usec" json:"timestamp_usec,omitempty"`
TimestampUsec *int64 `protobuf:"varint,1,req,name=timestamp_usec,json=timestampUsec" json:"timestamp_usec,omitempty"`
Level *int64 `protobuf:"varint,2,req,name=level" json:"level,omitempty"`
Message *string `protobuf:"bytes,3,req,name=message" json:"message,omitempty"`
XXX_unrecognized []byte `json:"-"`
@ -89,6 +96,7 @@ type UserAppLogLine struct {
func (m *UserAppLogLine) Reset() { *m = UserAppLogLine{} }
func (m *UserAppLogLine) String() string { return proto.CompactTextString(m) }
func (*UserAppLogLine) ProtoMessage() {}
func (*UserAppLogLine) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *UserAppLogLine) GetTimestampUsec() int64 {
if m != nil && m.TimestampUsec != nil {
@ -112,13 +120,14 @@ func (m *UserAppLogLine) GetMessage() string {
}
type UserAppLogGroup struct {
LogLine []*UserAppLogLine `protobuf:"bytes,2,rep,name=log_line" json:"log_line,omitempty"`
LogLine []*UserAppLogLine `protobuf:"bytes,2,rep,name=log_line,json=logLine" json:"log_line,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserAppLogGroup) Reset() { *m = UserAppLogGroup{} }
func (m *UserAppLogGroup) String() string { return proto.CompactTextString(m) }
func (*UserAppLogGroup) ProtoMessage() {}
func (*UserAppLogGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *UserAppLogGroup) GetLogLine() []*UserAppLogLine {
if m != nil {
@ -135,6 +144,7 @@ type FlushRequest struct {
func (m *FlushRequest) Reset() { *m = FlushRequest{} }
func (m *FlushRequest) String() string { return proto.CompactTextString(m) }
func (*FlushRequest) ProtoMessage() {}
func (*FlushRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *FlushRequest) GetLogs() []byte {
if m != nil {
@ -151,6 +161,7 @@ type SetStatusRequest struct {
func (m *SetStatusRequest) Reset() { *m = SetStatusRequest{} }
func (m *SetStatusRequest) String() string { return proto.CompactTextString(m) }
func (*SetStatusRequest) ProtoMessage() {}
func (*SetStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *SetStatusRequest) GetStatus() string {
if m != nil && m.Status != nil {
@ -160,13 +171,14 @@ func (m *SetStatusRequest) GetStatus() string {
}
type LogOffset struct {
RequestId []byte `protobuf:"bytes,1,opt,name=request_id" json:"request_id,omitempty"`
RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId" json:"request_id,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LogOffset) Reset() { *m = LogOffset{} }
func (m *LogOffset) String() string { return proto.CompactTextString(m) }
func (*LogOffset) ProtoMessage() {}
func (*LogOffset) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *LogOffset) GetRequestId() []byte {
if m != nil {
@ -178,13 +190,14 @@ func (m *LogOffset) GetRequestId() []byte {
type LogLine struct {
Time *int64 `protobuf:"varint,1,req,name=time" json:"time,omitempty"`
Level *int32 `protobuf:"varint,2,req,name=level" json:"level,omitempty"`
LogMessage *string `protobuf:"bytes,3,req,name=log_message" json:"log_message,omitempty"`
LogMessage *string `protobuf:"bytes,3,req,name=log_message,json=logMessage" json:"log_message,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LogLine) Reset() { *m = LogLine{} }
func (m *LogLine) String() string { return proto.CompactTextString(m) }
func (*LogLine) ProtoMessage() {}
func (*LogLine) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *LogLine) GetTime() int64 {
if m != nil && m.Time != nil {
@ -208,50 +221,51 @@ func (m *LogLine) GetLogMessage() string {
}
type RequestLog struct {
AppId *string `protobuf:"bytes,1,req,name=app_id" json:"app_id,omitempty"`
ModuleId *string `protobuf:"bytes,37,opt,name=module_id,def=default" json:"module_id,omitempty"`
VersionId *string `protobuf:"bytes,2,req,name=version_id" json:"version_id,omitempty"`
RequestId []byte `protobuf:"bytes,3,req,name=request_id" json:"request_id,omitempty"`
AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"`
ModuleId *string `protobuf:"bytes,37,opt,name=module_id,json=moduleId,def=default" json:"module_id,omitempty"`
VersionId *string `protobuf:"bytes,2,req,name=version_id,json=versionId" json:"version_id,omitempty"`
RequestId []byte `protobuf:"bytes,3,req,name=request_id,json=requestId" json:"request_id,omitempty"`
Offset *LogOffset `protobuf:"bytes,35,opt,name=offset" json:"offset,omitempty"`
Ip *string `protobuf:"bytes,4,req,name=ip" json:"ip,omitempty"`
Nickname *string `protobuf:"bytes,5,opt,name=nickname" json:"nickname,omitempty"`
StartTime *int64 `protobuf:"varint,6,req,name=start_time" json:"start_time,omitempty"`
EndTime *int64 `protobuf:"varint,7,req,name=end_time" json:"end_time,omitempty"`
StartTime *int64 `protobuf:"varint,6,req,name=start_time,json=startTime" json:"start_time,omitempty"`
EndTime *int64 `protobuf:"varint,7,req,name=end_time,json=endTime" json:"end_time,omitempty"`
Latency *int64 `protobuf:"varint,8,req,name=latency" json:"latency,omitempty"`
Mcycles *int64 `protobuf:"varint,9,req,name=mcycles" json:"mcycles,omitempty"`
Method *string `protobuf:"bytes,10,req,name=method" json:"method,omitempty"`
Resource *string `protobuf:"bytes,11,req,name=resource" json:"resource,omitempty"`
HttpVersion *string `protobuf:"bytes,12,req,name=http_version" json:"http_version,omitempty"`
HttpVersion *string `protobuf:"bytes,12,req,name=http_version,json=httpVersion" json:"http_version,omitempty"`
Status *int32 `protobuf:"varint,13,req,name=status" json:"status,omitempty"`
ResponseSize *int64 `protobuf:"varint,14,req,name=response_size" json:"response_size,omitempty"`
ResponseSize *int64 `protobuf:"varint,14,req,name=response_size,json=responseSize" json:"response_size,omitempty"`
Referrer *string `protobuf:"bytes,15,opt,name=referrer" json:"referrer,omitempty"`
UserAgent *string `protobuf:"bytes,16,opt,name=user_agent" json:"user_agent,omitempty"`
UrlMapEntry *string `protobuf:"bytes,17,req,name=url_map_entry" json:"url_map_entry,omitempty"`
UserAgent *string `protobuf:"bytes,16,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"`
UrlMapEntry *string `protobuf:"bytes,17,req,name=url_map_entry,json=urlMapEntry" json:"url_map_entry,omitempty"`
Combined *string `protobuf:"bytes,18,req,name=combined" json:"combined,omitempty"`
ApiMcycles *int64 `protobuf:"varint,19,opt,name=api_mcycles" json:"api_mcycles,omitempty"`
ApiMcycles *int64 `protobuf:"varint,19,opt,name=api_mcycles,json=apiMcycles" json:"api_mcycles,omitempty"`
Host *string `protobuf:"bytes,20,opt,name=host" json:"host,omitempty"`
Cost *float64 `protobuf:"fixed64,21,opt,name=cost" json:"cost,omitempty"`
TaskQueueName *string `protobuf:"bytes,22,opt,name=task_queue_name" json:"task_queue_name,omitempty"`
TaskName *string `protobuf:"bytes,23,opt,name=task_name" json:"task_name,omitempty"`
WasLoadingRequest *bool `protobuf:"varint,24,opt,name=was_loading_request" json:"was_loading_request,omitempty"`
PendingTime *int64 `protobuf:"varint,25,opt,name=pending_time" json:"pending_time,omitempty"`
ReplicaIndex *int32 `protobuf:"varint,26,opt,name=replica_index,def=-1" json:"replica_index,omitempty"`
TaskQueueName *string `protobuf:"bytes,22,opt,name=task_queue_name,json=taskQueueName" json:"task_queue_name,omitempty"`
TaskName *string `protobuf:"bytes,23,opt,name=task_name,json=taskName" json:"task_name,omitempty"`
WasLoadingRequest *bool `protobuf:"varint,24,opt,name=was_loading_request,json=wasLoadingRequest" json:"was_loading_request,omitempty"`
PendingTime *int64 `protobuf:"varint,25,opt,name=pending_time,json=pendingTime" json:"pending_time,omitempty"`
ReplicaIndex *int32 `protobuf:"varint,26,opt,name=replica_index,json=replicaIndex,def=-1" json:"replica_index,omitempty"`
Finished *bool `protobuf:"varint,27,opt,name=finished,def=1" json:"finished,omitempty"`
CloneKey []byte `protobuf:"bytes,28,opt,name=clone_key" json:"clone_key,omitempty"`
CloneKey []byte `protobuf:"bytes,28,opt,name=clone_key,json=cloneKey" json:"clone_key,omitempty"`
Line []*LogLine `protobuf:"bytes,29,rep,name=line" json:"line,omitempty"`
LinesIncomplete *bool `protobuf:"varint,36,opt,name=lines_incomplete" json:"lines_incomplete,omitempty"`
AppEngineRelease []byte `protobuf:"bytes,38,opt,name=app_engine_release" json:"app_engine_release,omitempty"`
ExitReason *int32 `protobuf:"varint,30,opt,name=exit_reason" json:"exit_reason,omitempty"`
WasThrottledForTime *bool `protobuf:"varint,31,opt,name=was_throttled_for_time" json:"was_throttled_for_time,omitempty"`
WasThrottledForRequests *bool `protobuf:"varint,32,opt,name=was_throttled_for_requests" json:"was_throttled_for_requests,omitempty"`
ThrottledTime *int64 `protobuf:"varint,33,opt,name=throttled_time" json:"throttled_time,omitempty"`
ServerName []byte `protobuf:"bytes,34,opt,name=server_name" json:"server_name,omitempty"`
LinesIncomplete *bool `protobuf:"varint,36,opt,name=lines_incomplete,json=linesIncomplete" json:"lines_incomplete,omitempty"`
AppEngineRelease []byte `protobuf:"bytes,38,opt,name=app_engine_release,json=appEngineRelease" json:"app_engine_release,omitempty"`
ExitReason *int32 `protobuf:"varint,30,opt,name=exit_reason,json=exitReason" json:"exit_reason,omitempty"`
WasThrottledForTime *bool `protobuf:"varint,31,opt,name=was_throttled_for_time,json=wasThrottledForTime" json:"was_throttled_for_time,omitempty"`
WasThrottledForRequests *bool `protobuf:"varint,32,opt,name=was_throttled_for_requests,json=wasThrottledForRequests" json:"was_throttled_for_requests,omitempty"`
ThrottledTime *int64 `protobuf:"varint,33,opt,name=throttled_time,json=throttledTime" json:"throttled_time,omitempty"`
ServerName []byte `protobuf:"bytes,34,opt,name=server_name,json=serverName" json:"server_name,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *RequestLog) Reset() { *m = RequestLog{} }
func (m *RequestLog) String() string { return proto.CompactTextString(m) }
func (*RequestLog) ProtoMessage() {}
func (*RequestLog) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
const Default_RequestLog_ModuleId string = "default"
const Default_RequestLog_ReplicaIndex int32 = -1
@ -524,14 +538,15 @@ func (m *RequestLog) GetServerName() []byte {
}
type LogModuleVersion struct {
ModuleId *string `protobuf:"bytes,1,opt,name=module_id,def=default" json:"module_id,omitempty"`
VersionId *string `protobuf:"bytes,2,opt,name=version_id" json:"version_id,omitempty"`
ModuleId *string `protobuf:"bytes,1,opt,name=module_id,json=moduleId,def=default" json:"module_id,omitempty"`
VersionId *string `protobuf:"bytes,2,opt,name=version_id,json=versionId" json:"version_id,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LogModuleVersion) Reset() { *m = LogModuleVersion{} }
func (m *LogModuleVersion) String() string { return proto.CompactTextString(m) }
func (*LogModuleVersion) ProtoMessage() {}
func (*LogModuleVersion) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
const Default_LogModuleVersion_ModuleId string = "default"
@ -550,31 +565,32 @@ func (m *LogModuleVersion) GetVersionId() string {
}
type LogReadRequest struct {
AppId *string `protobuf:"bytes,1,req,name=app_id" json:"app_id,omitempty"`
VersionId []string `protobuf:"bytes,2,rep,name=version_id" json:"version_id,omitempty"`
ModuleVersion []*LogModuleVersion `protobuf:"bytes,19,rep,name=module_version" json:"module_version,omitempty"`
StartTime *int64 `protobuf:"varint,3,opt,name=start_time" json:"start_time,omitempty"`
EndTime *int64 `protobuf:"varint,4,opt,name=end_time" json:"end_time,omitempty"`
AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"`
VersionId []string `protobuf:"bytes,2,rep,name=version_id,json=versionId" json:"version_id,omitempty"`
ModuleVersion []*LogModuleVersion `protobuf:"bytes,19,rep,name=module_version,json=moduleVersion" json:"module_version,omitempty"`
StartTime *int64 `protobuf:"varint,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"`
EndTime *int64 `protobuf:"varint,4,opt,name=end_time,json=endTime" json:"end_time,omitempty"`
Offset *LogOffset `protobuf:"bytes,5,opt,name=offset" json:"offset,omitempty"`
RequestId [][]byte `protobuf:"bytes,6,rep,name=request_id" json:"request_id,omitempty"`
MinimumLogLevel *int32 `protobuf:"varint,7,opt,name=minimum_log_level" json:"minimum_log_level,omitempty"`
IncludeIncomplete *bool `protobuf:"varint,8,opt,name=include_incomplete" json:"include_incomplete,omitempty"`
RequestId [][]byte `protobuf:"bytes,6,rep,name=request_id,json=requestId" json:"request_id,omitempty"`
MinimumLogLevel *int32 `protobuf:"varint,7,opt,name=minimum_log_level,json=minimumLogLevel" json:"minimum_log_level,omitempty"`
IncludeIncomplete *bool `protobuf:"varint,8,opt,name=include_incomplete,json=includeIncomplete" json:"include_incomplete,omitempty"`
Count *int64 `protobuf:"varint,9,opt,name=count" json:"count,omitempty"`
CombinedLogRegex *string `protobuf:"bytes,14,opt,name=combined_log_regex" json:"combined_log_regex,omitempty"`
HostRegex *string `protobuf:"bytes,15,opt,name=host_regex" json:"host_regex,omitempty"`
ReplicaIndex *int32 `protobuf:"varint,16,opt,name=replica_index" json:"replica_index,omitempty"`
IncludeAppLogs *bool `protobuf:"varint,10,opt,name=include_app_logs" json:"include_app_logs,omitempty"`
AppLogsPerRequest *int32 `protobuf:"varint,17,opt,name=app_logs_per_request" json:"app_logs_per_request,omitempty"`
IncludeHost *bool `protobuf:"varint,11,opt,name=include_host" json:"include_host,omitempty"`
IncludeAll *bool `protobuf:"varint,12,opt,name=include_all" json:"include_all,omitempty"`
CacheIterator *bool `protobuf:"varint,13,opt,name=cache_iterator" json:"cache_iterator,omitempty"`
NumShards *int32 `protobuf:"varint,18,opt,name=num_shards" json:"num_shards,omitempty"`
CombinedLogRegex *string `protobuf:"bytes,14,opt,name=combined_log_regex,json=combinedLogRegex" json:"combined_log_regex,omitempty"`
HostRegex *string `protobuf:"bytes,15,opt,name=host_regex,json=hostRegex" json:"host_regex,omitempty"`
ReplicaIndex *int32 `protobuf:"varint,16,opt,name=replica_index,json=replicaIndex" json:"replica_index,omitempty"`
IncludeAppLogs *bool `protobuf:"varint,10,opt,name=include_app_logs,json=includeAppLogs" json:"include_app_logs,omitempty"`
AppLogsPerRequest *int32 `protobuf:"varint,17,opt,name=app_logs_per_request,json=appLogsPerRequest" json:"app_logs_per_request,omitempty"`
IncludeHost *bool `protobuf:"varint,11,opt,name=include_host,json=includeHost" json:"include_host,omitempty"`
IncludeAll *bool `protobuf:"varint,12,opt,name=include_all,json=includeAll" json:"include_all,omitempty"`
CacheIterator *bool `protobuf:"varint,13,opt,name=cache_iterator,json=cacheIterator" json:"cache_iterator,omitempty"`
NumShards *int32 `protobuf:"varint,18,opt,name=num_shards,json=numShards" json:"num_shards,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LogReadRequest) Reset() { *m = LogReadRequest{} }
func (m *LogReadRequest) String() string { return proto.CompactTextString(m) }
func (*LogReadRequest) ProtoMessage() {}
func (*LogReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *LogReadRequest) GetAppId() string {
if m != nil && m.AppId != nil {
@ -712,13 +728,14 @@ func (m *LogReadRequest) GetNumShards() int32 {
type LogReadResponse struct {
Log []*RequestLog `protobuf:"bytes,1,rep,name=log" json:"log,omitempty"`
Offset *LogOffset `protobuf:"bytes,2,opt,name=offset" json:"offset,omitempty"`
LastEndTime *int64 `protobuf:"varint,3,opt,name=last_end_time" json:"last_end_time,omitempty"`
LastEndTime *int64 `protobuf:"varint,3,opt,name=last_end_time,json=lastEndTime" json:"last_end_time,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LogReadResponse) Reset() { *m = LogReadResponse{} }
func (m *LogReadResponse) String() string { return proto.CompactTextString(m) }
func (*LogReadResponse) ProtoMessage() {}
func (*LogReadResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *LogReadResponse) GetLog() []*RequestLog {
if m != nil {
@ -742,11 +759,11 @@ func (m *LogReadResponse) GetLastEndTime() int64 {
}
type LogUsageRecord struct {
VersionId *string `protobuf:"bytes,1,opt,name=version_id" json:"version_id,omitempty"`
StartTime *int32 `protobuf:"varint,2,opt,name=start_time" json:"start_time,omitempty"`
EndTime *int32 `protobuf:"varint,3,opt,name=end_time" json:"end_time,omitempty"`
VersionId *string `protobuf:"bytes,1,opt,name=version_id,json=versionId" json:"version_id,omitempty"`
StartTime *int32 `protobuf:"varint,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"`
EndTime *int32 `protobuf:"varint,3,opt,name=end_time,json=endTime" json:"end_time,omitempty"`
Count *int64 `protobuf:"varint,4,opt,name=count" json:"count,omitempty"`
TotalSize *int64 `protobuf:"varint,5,opt,name=total_size" json:"total_size,omitempty"`
TotalSize *int64 `protobuf:"varint,5,opt,name=total_size,json=totalSize" json:"total_size,omitempty"`
Records *int32 `protobuf:"varint,6,opt,name=records" json:"records,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
@ -754,6 +771,7 @@ type LogUsageRecord struct {
func (m *LogUsageRecord) Reset() { *m = LogUsageRecord{} }
func (m *LogUsageRecord) String() string { return proto.CompactTextString(m) }
func (*LogUsageRecord) ProtoMessage() {}
func (*LogUsageRecord) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *LogUsageRecord) GetVersionId() string {
if m != nil && m.VersionId != nil {
@ -798,20 +816,21 @@ func (m *LogUsageRecord) GetRecords() int32 {
}
type LogUsageRequest struct {
AppId *string `protobuf:"bytes,1,req,name=app_id" json:"app_id,omitempty"`
VersionId []string `protobuf:"bytes,2,rep,name=version_id" json:"version_id,omitempty"`
StartTime *int32 `protobuf:"varint,3,opt,name=start_time" json:"start_time,omitempty"`
EndTime *int32 `protobuf:"varint,4,opt,name=end_time" json:"end_time,omitempty"`
ResolutionHours *uint32 `protobuf:"varint,5,opt,name=resolution_hours,def=1" json:"resolution_hours,omitempty"`
CombineVersions *bool `protobuf:"varint,6,opt,name=combine_versions" json:"combine_versions,omitempty"`
UsageVersion *int32 `protobuf:"varint,7,opt,name=usage_version" json:"usage_version,omitempty"`
VersionsOnly *bool `protobuf:"varint,8,opt,name=versions_only" json:"versions_only,omitempty"`
AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"`
VersionId []string `protobuf:"bytes,2,rep,name=version_id,json=versionId" json:"version_id,omitempty"`
StartTime *int32 `protobuf:"varint,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"`
EndTime *int32 `protobuf:"varint,4,opt,name=end_time,json=endTime" json:"end_time,omitempty"`
ResolutionHours *uint32 `protobuf:"varint,5,opt,name=resolution_hours,json=resolutionHours,def=1" json:"resolution_hours,omitempty"`
CombineVersions *bool `protobuf:"varint,6,opt,name=combine_versions,json=combineVersions" json:"combine_versions,omitempty"`
UsageVersion *int32 `protobuf:"varint,7,opt,name=usage_version,json=usageVersion" json:"usage_version,omitempty"`
VersionsOnly *bool `protobuf:"varint,8,opt,name=versions_only,json=versionsOnly" json:"versions_only,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LogUsageRequest) Reset() { *m = LogUsageRequest{} }
func (m *LogUsageRequest) String() string { return proto.CompactTextString(m) }
func (*LogUsageRequest) ProtoMessage() {}
func (*LogUsageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
const Default_LogUsageRequest_ResolutionHours uint32 = 1
@ -880,6 +899,7 @@ type LogUsageResponse struct {
func (m *LogUsageResponse) Reset() { *m = LogUsageResponse{} }
func (m *LogUsageResponse) String() string { return proto.CompactTextString(m) }
func (*LogUsageResponse) ProtoMessage() {}
func (*LogUsageResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (m *LogUsageResponse) GetUsage() []*LogUsageRecord {
if m != nil {
@ -896,4 +916,124 @@ func (m *LogUsageResponse) GetSummary() *LogUsageRecord {
}
func init() {
proto.RegisterType((*LogServiceError)(nil), "appengine.LogServiceError")
proto.RegisterType((*UserAppLogLine)(nil), "appengine.UserAppLogLine")
proto.RegisterType((*UserAppLogGroup)(nil), "appengine.UserAppLogGroup")
proto.RegisterType((*FlushRequest)(nil), "appengine.FlushRequest")
proto.RegisterType((*SetStatusRequest)(nil), "appengine.SetStatusRequest")
proto.RegisterType((*LogOffset)(nil), "appengine.LogOffset")
proto.RegisterType((*LogLine)(nil), "appengine.LogLine")
proto.RegisterType((*RequestLog)(nil), "appengine.RequestLog")
proto.RegisterType((*LogModuleVersion)(nil), "appengine.LogModuleVersion")
proto.RegisterType((*LogReadRequest)(nil), "appengine.LogReadRequest")
proto.RegisterType((*LogReadResponse)(nil), "appengine.LogReadResponse")
proto.RegisterType((*LogUsageRecord)(nil), "appengine.LogUsageRecord")
proto.RegisterType((*LogUsageRequest)(nil), "appengine.LogUsageRequest")
proto.RegisterType((*LogUsageResponse)(nil), "appengine.LogUsageResponse")
}
func init() {
proto.RegisterFile("google.golang.org/appengine/internal/log/log_service.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 1553 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x72, 0xdb, 0xc6,
0x15, 0x2e, 0x48, 0x51, 0x24, 0x0f, 0x49, 0x91, 0x5a, 0xcb, 0xce, 0xda, 0xae, 0x6b, 0x1a, 0x4e,
0x1c, 0xd6, 0x93, 0x48, 0x93, 0xa4, 0x57, 0xca, 0x95, 0xd3, 0x2a, 0x8e, 0x26, 0xb4, 0xd5, 0x40,
0x72, 0x3a, 0xd3, 0x1b, 0x0c, 0x0a, 0x1c, 0x81, 0x18, 0x2f, 0xb1, 0xc8, 0xee, 0xc2, 0x91, 0x72,
0xdb, 0xdb, 0x3e, 0x46, 0x1f, 0xa2, 0xaf, 0xd2, 0xb7, 0xe9, 0xec, 0xd9, 0x05, 0x44, 0x2a, 0x4d,
0xc6, 0x33, 0xb9, 0xe0, 0x10, 0xfb, 0x9d, 0x83, 0xdd, 0xf3, 0xf3, 0x9d, 0x6f, 0x01, 0xc7, 0xb9,
0x94, 0xb9, 0xc0, 0xc3, 0x5c, 0x8a, 0xa4, 0xcc, 0x0f, 0xa5, 0xca, 0x8f, 0x92, 0xaa, 0xc2, 0x32,
0x2f, 0x4a, 0x3c, 0x2a, 0x4a, 0x83, 0xaa, 0x4c, 0xc4, 0x91, 0x90, 0xb9, 0xfd, 0xc5, 0x1a, 0xd5,
0xbb, 0x22, 0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0x4a, 0xfa, 0xd0, 0x7f, 0x8b, 0x4c, 0xfc, 0x7c, 0xc4, 0x7b, 0xbf, 0x36,
0xe2, 0xbd, 0xcd, 0x11, 0x9f, 0xd9, 0xcf, 0x11, 0x51, 0x1b, 0xbb, 0xf7, 0x4a, 0xd6, 0x4a, 0x53,
0x0a, 0x93, 0xe3, 0xe0, 0xb3, 0x68, 0x7a, 0x63, 0xfa, 0xc6, 0x5a, 0xec, 0x25, 0xe3, 0x07, 0xa7,
0xd1, 0x23, 0x97, 0xd4, 0x20, 0x9a, 0x7a, 0xdc, 0x8b, 0x0e, 0x7d, 0xa0, 0xd4, 0x36, 0xb1, 0x56,
0xb8, 0xdc, 0xa8, 0x8f, 0x09, 0x6c, 0xa4, 0xe9, 0x29, 0x4c, 0x9a, 0x7d, 0x62, 0x59, 0x8a, 0x6b,
0x3f, 0xe2, 0xe3, 0x06, 0x3c, 0x2b, 0xc5, 0x75, 0x78, 0x45, 0x2a, 0xed, 0xab, 0xe4, 0x09, 0x77,
0x04, 0x3d, 0xda, 0xc8, 0x53, 0xee, 0xfe, 0x36, 0x8d, 0x36, 0xc8, 0x10, 0x39, 0x3f, 0xf6, 0x05,
0xf4, 0x75, 0xbd, 0x5e, 0x27, 0xea, 0xda, 0x33, 0xef, 0x57, 0x5e, 0x69, 0x3c, 0xbf, 0xea, 0xfd,
0xdd, 0x92, 0xf6, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, 0xd9, 0xa0, 0xf8, 0x48, 0x0d, 0x00,
0x00,
}

View File

@ -22,7 +22,11 @@ func Main() {
port = s
}
if err := http.ListenAndServe(":"+port, http.HandlerFunc(handleHTTP)); err != nil {
host := ""
if IsDevAppServer() {
host = "127.0.0.1"
}
if err := http.ListenAndServe(host+":"+port, http.HandlerFunc(handleHTTP)); err != nil {
log.Fatalf("http.ListenAndServe: %v", err)
}
}

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google.golang.org/appengine/internal/modules/modules_service.proto
// DO NOT EDIT!
/*
Package modules is a generated protocol buffer package.
@ -38,6 +37,12 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type ModulesServiceError_ErrorCode int32
const (
@ -82,6 +87,9 @@ func (x *ModulesServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
*x = ModulesServiceError_ErrorCode(value)
return nil
}
func (ModulesServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{0, 0}
}
type ModulesServiceError struct {
XXX_unrecognized []byte `json:"-"`
@ -90,6 +98,7 @@ type ModulesServiceError struct {
func (m *ModulesServiceError) Reset() { *m = ModulesServiceError{} }
func (m *ModulesServiceError) String() string { return proto.CompactTextString(m) }
func (*ModulesServiceError) ProtoMessage() {}
func (*ModulesServiceError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type GetModulesRequest struct {
XXX_unrecognized []byte `json:"-"`
@ -98,6 +107,7 @@ type GetModulesRequest struct {
func (m *GetModulesRequest) Reset() { *m = GetModulesRequest{} }
func (m *GetModulesRequest) String() string { return proto.CompactTextString(m) }
func (*GetModulesRequest) ProtoMessage() {}
func (*GetModulesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
type GetModulesResponse struct {
Module []string `protobuf:"bytes,1,rep,name=module" json:"module,omitempty"`
@ -107,6 +117,7 @@ type GetModulesResponse struct {
func (m *GetModulesResponse) Reset() { *m = GetModulesResponse{} }
func (m *GetModulesResponse) String() string { return proto.CompactTextString(m) }
func (*GetModulesResponse) ProtoMessage() {}
func (*GetModulesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *GetModulesResponse) GetModule() []string {
if m != nil {
@ -123,6 +134,7 @@ type GetVersionsRequest struct {
func (m *GetVersionsRequest) Reset() { *m = GetVersionsRequest{} }
func (m *GetVersionsRequest) String() string { return proto.CompactTextString(m) }
func (*GetVersionsRequest) ProtoMessage() {}
func (*GetVersionsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *GetVersionsRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -139,6 +151,7 @@ type GetVersionsResponse struct {
func (m *GetVersionsResponse) Reset() { *m = GetVersionsResponse{} }
func (m *GetVersionsResponse) String() string { return proto.CompactTextString(m) }
func (*GetVersionsResponse) ProtoMessage() {}
func (*GetVersionsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *GetVersionsResponse) GetVersion() []string {
if m != nil {
@ -155,6 +168,7 @@ type GetDefaultVersionRequest struct {
func (m *GetDefaultVersionRequest) Reset() { *m = GetDefaultVersionRequest{} }
func (m *GetDefaultVersionRequest) String() string { return proto.CompactTextString(m) }
func (*GetDefaultVersionRequest) ProtoMessage() {}
func (*GetDefaultVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *GetDefaultVersionRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -171,6 +185,7 @@ type GetDefaultVersionResponse struct {
func (m *GetDefaultVersionResponse) Reset() { *m = GetDefaultVersionResponse{} }
func (m *GetDefaultVersionResponse) String() string { return proto.CompactTextString(m) }
func (*GetDefaultVersionResponse) ProtoMessage() {}
func (*GetDefaultVersionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *GetDefaultVersionResponse) GetVersion() string {
if m != nil && m.Version != nil {
@ -188,6 +203,7 @@ type GetNumInstancesRequest struct {
func (m *GetNumInstancesRequest) Reset() { *m = GetNumInstancesRequest{} }
func (m *GetNumInstancesRequest) String() string { return proto.CompactTextString(m) }
func (*GetNumInstancesRequest) ProtoMessage() {}
func (*GetNumInstancesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *GetNumInstancesRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -211,6 +227,7 @@ type GetNumInstancesResponse struct {
func (m *GetNumInstancesResponse) Reset() { *m = GetNumInstancesResponse{} }
func (m *GetNumInstancesResponse) String() string { return proto.CompactTextString(m) }
func (*GetNumInstancesResponse) ProtoMessage() {}
func (*GetNumInstancesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *GetNumInstancesResponse) GetInstances() int64 {
if m != nil && m.Instances != nil {
@ -229,6 +246,7 @@ type SetNumInstancesRequest struct {
func (m *SetNumInstancesRequest) Reset() { *m = SetNumInstancesRequest{} }
func (m *SetNumInstancesRequest) String() string { return proto.CompactTextString(m) }
func (*SetNumInstancesRequest) ProtoMessage() {}
func (*SetNumInstancesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *SetNumInstancesRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -258,6 +276,7 @@ type SetNumInstancesResponse struct {
func (m *SetNumInstancesResponse) Reset() { *m = SetNumInstancesResponse{} }
func (m *SetNumInstancesResponse) String() string { return proto.CompactTextString(m) }
func (*SetNumInstancesResponse) ProtoMessage() {}
func (*SetNumInstancesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
type StartModuleRequest struct {
Module *string `protobuf:"bytes,1,req,name=module" json:"module,omitempty"`
@ -268,6 +287,7 @@ type StartModuleRequest struct {
func (m *StartModuleRequest) Reset() { *m = StartModuleRequest{} }
func (m *StartModuleRequest) String() string { return proto.CompactTextString(m) }
func (*StartModuleRequest) ProtoMessage() {}
func (*StartModuleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *StartModuleRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -290,6 +310,7 @@ type StartModuleResponse struct {
func (m *StartModuleResponse) Reset() { *m = StartModuleResponse{} }
func (m *StartModuleResponse) String() string { return proto.CompactTextString(m) }
func (*StartModuleResponse) ProtoMessage() {}
func (*StartModuleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
type StopModuleRequest struct {
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
@ -300,6 +321,7 @@ type StopModuleRequest struct {
func (m *StopModuleRequest) Reset() { *m = StopModuleRequest{} }
func (m *StopModuleRequest) String() string { return proto.CompactTextString(m) }
func (*StopModuleRequest) ProtoMessage() {}
func (*StopModuleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (m *StopModuleRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -322,6 +344,7 @@ type StopModuleResponse struct {
func (m *StopModuleResponse) Reset() { *m = StopModuleResponse{} }
func (m *StopModuleResponse) String() string { return proto.CompactTextString(m) }
func (*StopModuleResponse) ProtoMessage() {}
func (*StopModuleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
type GetHostnameRequest struct {
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
@ -333,6 +356,7 @@ type GetHostnameRequest struct {
func (m *GetHostnameRequest) Reset() { *m = GetHostnameRequest{} }
func (m *GetHostnameRequest) String() string { return proto.CompactTextString(m) }
func (*GetHostnameRequest) ProtoMessage() {}
func (*GetHostnameRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (m *GetHostnameRequest) GetModule() string {
if m != nil && m.Module != nil {
@ -363,6 +387,7 @@ type GetHostnameResponse struct {
func (m *GetHostnameResponse) Reset() { *m = GetHostnameResponse{} }
func (m *GetHostnameResponse) String() string { return proto.CompactTextString(m) }
func (*GetHostnameResponse) ProtoMessage() {}
func (*GetHostnameResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (m *GetHostnameResponse) GetHostname() string {
if m != nil && m.Hostname != nil {
@ -372,4 +397,58 @@ func (m *GetHostnameResponse) GetHostname() string {
}
func init() {
proto.RegisterType((*ModulesServiceError)(nil), "appengine.ModulesServiceError")
proto.RegisterType((*GetModulesRequest)(nil), "appengine.GetModulesRequest")
proto.RegisterType((*GetModulesResponse)(nil), "appengine.GetModulesResponse")
proto.RegisterType((*GetVersionsRequest)(nil), "appengine.GetVersionsRequest")
proto.RegisterType((*GetVersionsResponse)(nil), "appengine.GetVersionsResponse")
proto.RegisterType((*GetDefaultVersionRequest)(nil), "appengine.GetDefaultVersionRequest")
proto.RegisterType((*GetDefaultVersionResponse)(nil), "appengine.GetDefaultVersionResponse")
proto.RegisterType((*GetNumInstancesRequest)(nil), "appengine.GetNumInstancesRequest")
proto.RegisterType((*GetNumInstancesResponse)(nil), "appengine.GetNumInstancesResponse")
proto.RegisterType((*SetNumInstancesRequest)(nil), "appengine.SetNumInstancesRequest")
proto.RegisterType((*SetNumInstancesResponse)(nil), "appengine.SetNumInstancesResponse")
proto.RegisterType((*StartModuleRequest)(nil), "appengine.StartModuleRequest")
proto.RegisterType((*StartModuleResponse)(nil), "appengine.StartModuleResponse")
proto.RegisterType((*StopModuleRequest)(nil), "appengine.StopModuleRequest")
proto.RegisterType((*StopModuleResponse)(nil), "appengine.StopModuleResponse")
proto.RegisterType((*GetHostnameRequest)(nil), "appengine.GetHostnameRequest")
proto.RegisterType((*GetHostnameResponse)(nil), "appengine.GetHostnameResponse")
}
func init() {
proto.RegisterFile("google.golang.org/appengine/internal/modules/modules_service.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 457 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xc1, 0x6f, 0xd3, 0x30,
0x14, 0xc6, 0x69, 0x02, 0xdb, 0xf2, 0x0e, 0x90, 0x3a, 0x5b, 0xd7, 0x4d, 0x1c, 0x50, 0x4e, 0x1c,
0x50, 0x2b, 0x90, 0x10, 0xe7, 0xae, 0x35, 0x25, 0xb0, 0xa5, 0x28, 0xce, 0x2a, 0xc4, 0xa5, 0x0a,
0xdb, 0x23, 0x8b, 0x94, 0xda, 0xc1, 0x76, 0x77, 0xe4, 0xbf, 0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0x61, 0xbe, 0xec, 0x29, 0x1c, 0xdc, 0x18,
0xcd, 0x8c, 0x68, 0x55, 0x9f, 0x79, 0x5f, 0xf7, 0xcd, 0x5f, 0xe2, 0x77, 0x00, 0x00, 0x00, 0xff,
0xff, 0x6e, 0xbc, 0xe0, 0x61, 0x5c, 0x04, 0x00, 0x00,
}

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google.golang.org/appengine/internal/remote_api/remote_api.proto
// DO NOT EDIT!
/*
Package remote_api is a generated protocol buffer package.
@ -25,6 +24,12 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type RpcError_ErrorCode int32
const (
@ -90,18 +95,20 @@ func (x *RpcError_ErrorCode) UnmarshalJSON(data []byte) error {
*x = RpcError_ErrorCode(value)
return nil
}
func (RpcError_ErrorCode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
type Request struct {
ServiceName *string `protobuf:"bytes,2,req,name=service_name" json:"service_name,omitempty"`
ServiceName *string `protobuf:"bytes,2,req,name=service_name,json=serviceName" json:"service_name,omitempty"`
Method *string `protobuf:"bytes,3,req,name=method" json:"method,omitempty"`
Request []byte `protobuf:"bytes,4,req,name=request" json:"request,omitempty"`
RequestId *string `protobuf:"bytes,5,opt,name=request_id" json:"request_id,omitempty"`
RequestId *string `protobuf:"bytes,5,opt,name=request_id,json=requestId" json:"request_id,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Request) GetServiceName() string {
if m != nil && m.ServiceName != nil {
@ -140,6 +147,7 @@ type ApplicationError struct {
func (m *ApplicationError) Reset() { *m = ApplicationError{} }
func (m *ApplicationError) String() string { return proto.CompactTextString(m) }
func (*ApplicationError) ProtoMessage() {}
func (*ApplicationError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *ApplicationError) GetCode() int32 {
if m != nil && m.Code != nil {
@ -164,6 +172,7 @@ type RpcError struct {
func (m *RpcError) Reset() { *m = RpcError{} }
func (m *RpcError) String() string { return proto.CompactTextString(m) }
func (*RpcError) ProtoMessage() {}
func (*RpcError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *RpcError) GetCode() int32 {
if m != nil && m.Code != nil {
@ -182,15 +191,16 @@ func (m *RpcError) GetDetail() string {
type Response struct {
Response []byte `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
Exception []byte `protobuf:"bytes,2,opt,name=exception" json:"exception,omitempty"`
ApplicationError *ApplicationError `protobuf:"bytes,3,opt,name=application_error" json:"application_error,omitempty"`
JavaException []byte `protobuf:"bytes,4,opt,name=java_exception" json:"java_exception,omitempty"`
RpcError *RpcError `protobuf:"bytes,5,opt,name=rpc_error" json:"rpc_error,omitempty"`
ApplicationError *ApplicationError `protobuf:"bytes,3,opt,name=application_error,json=applicationError" json:"application_error,omitempty"`
JavaException []byte `protobuf:"bytes,4,opt,name=java_exception,json=javaException" json:"java_exception,omitempty"`
RpcError *RpcError `protobuf:"bytes,5,opt,name=rpc_error,json=rpcError" json:"rpc_error,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *Response) GetResponse() []byte {
if m != nil {
@ -228,4 +238,50 @@ func (m *Response) GetRpcError() *RpcError {
}
func init() {
proto.RegisterType((*Request)(nil), "remote_api.Request")
proto.RegisterType((*ApplicationError)(nil), "remote_api.ApplicationError")
proto.RegisterType((*RpcError)(nil), "remote_api.RpcError")
proto.RegisterType((*Response)(nil), "remote_api.Response")
}
func init() {
proto.RegisterFile("google.golang.org/appengine/internal/remote_api/remote_api.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 531 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x51, 0x6e, 0xd3, 0x40,
0x10, 0x86, 0xb1, 0x9b, 0x34, 0xf1, 0xc4, 0x2d, 0xdb, 0xa5, 0x14, 0x0b, 0x15, 0x29, 0x44, 0x42,
0xca, 0x53, 0x2a, 0x38, 0x00, 0x62, 0x63, 0x6f, 0x91, 0x85, 0x65, 0xa7, 0x6b, 0xbb, 0x50, 0x5e,
0x56, 0x2b, 0x67, 0x65, 0x8c, 0x12, 0xaf, 0xd9, 0x98, 0x8a, 0x17, 0x6e, 0xc0, 0xb5, 0x38, 0x0c,
0xb7, 0x40, 0x36, 0x6e, 0x63, 0xf5, 0x89, 0xb7, 0x7f, 0x7e, 0x7b, 0xe6, 0x1b, 0xcd, 0xcc, 0xc2,
0xbb, 0x5c, 0xa9, 0x7c, 0x23, 0x17, 0xb9, 0xda, 0x88, 0x32, 0x5f, 0x28, 0x9d, 0x5f, 0x88, 0xaa,
0x92, 0x65, 0x5e, 0x94, 0xf2, 0xa2, 0x28, 0x6b, 0xa9, 0x4b, 0xb1, 0xb9, 0xd0, 0x72, 0xab, 0x6a,
0xc9, 0x45, 0x55, 0xf4, 0xe4, 0xa2, 0xd2, 0xaa, 0x56, 0x18, 0xf6, 0xce, 0xec, 0x27, 0x8c, 0x98,
0xfc, 0xf6, 0x5d, 0xee, 0x6a, 0xfc, 0x12, 0xec, 0x9d, 0xd4, 0xb7, 0x45, 0x26, 0x79, 0x29, 0xb6,
0xd2, 0x31, 0xa7, 0xe6, 0xdc, 0x62, 0x93, 0xce, 0x0b, 0xc5, 0x56, 0xe2, 0x33, 0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 0x22, 0x4f,
0x03, 0x00, 0x00,
}

View File

@ -54,9 +54,9 @@ type transaction struct {
var ErrConcurrentTransaction = errors.New("internal: concurrent transaction")
func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error, xg bool) error {
func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error, xg bool, readOnly bool, previousTransaction *pb.Transaction) (*pb.Transaction, error) {
if transactionFromContext(c) != nil {
return errors.New("nested transactions are not supported")
return nil, errors.New("nested transactions are not supported")
}
// Begin the transaction.
@ -67,8 +67,16 @@ func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error,
if xg {
req.AllowMultipleEg = proto.Bool(true)
}
if previousTransaction != nil {
req.PreviousTransaction = previousTransaction
}
if readOnly {
req.Mode = pb.BeginTransactionRequest_READ_ONLY.Enum()
} else {
req.Mode = pb.BeginTransactionRequest_READ_WRITE.Enum()
}
if err := Call(c, "datastore_v3", "BeginTransaction", req, &t.transaction); err != nil {
return err
return nil, err
}
// Call f, rolling back the transaction if f returns a non-nil error, or panics.
@ -83,7 +91,7 @@ func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error,
Call(c, "datastore_v3", "Rollback", &t.transaction, &basepb.VoidProto{})
}()
if err := f(withTransaction(c, t)); err != nil {
return err
return &t.transaction, err
}
t.finished = true
@ -97,11 +105,11 @@ func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error,
// The Python Dev AppServer raises an ApplicationError with error code 2 (which is
// Error.CONCURRENT_TRANSACTION) and message "Concurrency exception.".
if ae.Code == int32(pb.Error_BAD_REQUEST) && ae.Detail == "ApplicationError: 2 Concurrency exception." {
return ErrConcurrentTransaction
return &t.transaction, ErrConcurrentTransaction
}
if ae.Code == int32(pb.Error_CONCURRENT_TRANSACTION) {
return ErrConcurrentTransaction
return &t.transaction, ErrConcurrentTransaction
}
}
return err
return &t.transaction, err
}

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto
// DO NOT EDIT!
/*
Package urlfetch is a generated protocol buffer package.
@ -24,6 +23,12 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type URLFetchServiceError_ErrorCode int32
const (
@ -89,6 +94,9 @@ func (x *URLFetchServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
*x = URLFetchServiceError_ErrorCode(value)
return nil
}
func (URLFetchServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{0, 0}
}
type URLFetchRequest_RequestMethod int32
@ -134,6 +142,9 @@ func (x *URLFetchRequest_RequestMethod) UnmarshalJSON(data []byte) error {
*x = URLFetchRequest_RequestMethod(value)
return nil
}
func (URLFetchRequest_RequestMethod) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{1, 0}
}
type URLFetchServiceError struct {
XXX_unrecognized []byte `json:"-"`
@ -142,11 +153,12 @@ type URLFetchServiceError struct {
func (m *URLFetchServiceError) Reset() { *m = URLFetchServiceError{} }
func (m *URLFetchServiceError) String() string { return proto.CompactTextString(m) }
func (*URLFetchServiceError) ProtoMessage() {}
func (*URLFetchServiceError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type URLFetchRequest struct {
Method *URLFetchRequest_RequestMethod `protobuf:"varint,1,req,name=Method,enum=appengine.URLFetchRequest_RequestMethod" json:"Method,omitempty"`
Url *string `protobuf:"bytes,2,req,name=Url" json:"Url,omitempty"`
Header []*URLFetchRequest_Header `protobuf:"group,3,rep,name=Header" json:"header,omitempty"`
Header []*URLFetchRequest_Header `protobuf:"group,3,rep,name=Header,json=header" json:"header,omitempty"`
Payload []byte `protobuf:"bytes,6,opt,name=Payload" json:"Payload,omitempty"`
FollowRedirects *bool `protobuf:"varint,7,opt,name=FollowRedirects,def=1" json:"FollowRedirects,omitempty"`
Deadline *float64 `protobuf:"fixed64,8,opt,name=Deadline" json:"Deadline,omitempty"`
@ -157,6 +169,7 @@ type URLFetchRequest struct {
func (m *URLFetchRequest) Reset() { *m = URLFetchRequest{} }
func (m *URLFetchRequest) String() string { return proto.CompactTextString(m) }
func (*URLFetchRequest) ProtoMessage() {}
func (*URLFetchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
const Default_URLFetchRequest_FollowRedirects bool = true
const Default_URLFetchRequest_MustValidateServerCertificate bool = true
@ -219,6 +232,7 @@ type URLFetchRequest_Header struct {
func (m *URLFetchRequest_Header) Reset() { *m = URLFetchRequest_Header{} }
func (m *URLFetchRequest_Header) String() string { return proto.CompactTextString(m) }
func (*URLFetchRequest_Header) ProtoMessage() {}
func (*URLFetchRequest_Header) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} }
func (m *URLFetchRequest_Header) GetKey() string {
if m != nil && m.Key != nil {
@ -237,7 +251,7 @@ func (m *URLFetchRequest_Header) GetValue() string {
type URLFetchResponse struct {
Content []byte `protobuf:"bytes,1,opt,name=Content" json:"Content,omitempty"`
StatusCode *int32 `protobuf:"varint,2,req,name=StatusCode" json:"StatusCode,omitempty"`
Header []*URLFetchResponse_Header `protobuf:"group,3,rep,name=Header" json:"header,omitempty"`
Header []*URLFetchResponse_Header `protobuf:"group,3,rep,name=Header,json=header" json:"header,omitempty"`
ContentWasTruncated *bool `protobuf:"varint,6,opt,name=ContentWasTruncated,def=0" json:"ContentWasTruncated,omitempty"`
ExternalBytesSent *int64 `protobuf:"varint,7,opt,name=ExternalBytesSent" json:"ExternalBytesSent,omitempty"`
ExternalBytesReceived *int64 `protobuf:"varint,8,opt,name=ExternalBytesReceived" json:"ExternalBytesReceived,omitempty"`
@ -251,6 +265,7 @@ type URLFetchResponse struct {
func (m *URLFetchResponse) Reset() { *m = URLFetchResponse{} }
func (m *URLFetchResponse) String() string { return proto.CompactTextString(m) }
func (*URLFetchResponse) ProtoMessage() {}
func (*URLFetchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
const Default_URLFetchResponse_ContentWasTruncated bool = false
const Default_URLFetchResponse_ApiCpuMilliseconds int64 = 0
@ -336,6 +351,7 @@ type URLFetchResponse_Header struct {
func (m *URLFetchResponse_Header) Reset() { *m = URLFetchResponse_Header{} }
func (m *URLFetchResponse_Header) String() string { return proto.CompactTextString(m) }
func (*URLFetchResponse_Header) ProtoMessage() {}
func (*URLFetchResponse_Header) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
func (m *URLFetchResponse_Header) GetKey() string {
if m != nil && m.Key != nil {
@ -352,4 +368,66 @@ func (m *URLFetchResponse_Header) GetValue() string {
}
func init() {
proto.RegisterType((*URLFetchServiceError)(nil), "appengine.URLFetchServiceError")
proto.RegisterType((*URLFetchRequest)(nil), "appengine.URLFetchRequest")
proto.RegisterType((*URLFetchRequest_Header)(nil), "appengine.URLFetchRequest.Header")
proto.RegisterType((*URLFetchResponse)(nil), "appengine.URLFetchResponse")
proto.RegisterType((*URLFetchResponse_Header)(nil), "appengine.URLFetchResponse.Header")
}
func init() {
proto.RegisterFile("google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 770 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0xe3, 0x54,
0x10, 0xc6, 0x76, 0x7e, 0xa7, 0x5d, 0x7a, 0x76, 0xb6, 0x45, 0x66, 0xb5, 0xa0, 0x10, 0x09, 0x29,
0x17, 0x90, 0x2e, 0x2b, 0x24, 0x44, 0xaf, 0x70, 0xed, 0x93, 0xad, 0xa9, 0x63, 0x47, 0xc7, 0x4e,
0x61, 0xb9, 0xb1, 0xac, 0x78, 0x9a, 0x5a, 0xb2, 0xec, 0x60, 0x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