Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package pubsub | 5 package pubsub |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "flag" | 8 "flag" |
| 9 ) | 9 ) |
| 10 | 10 |
| 11 // Topic is a fully-qualified Pub/Sub project/topic name. | 11 // Topic is a fully-qualified Pub/Sub project/topic name. |
| 12 type Topic string | 12 type Topic string |
| 13 | 13 |
| 14 var _ flag.Value = (*Topic)(nil) | 14 var _ flag.Value = (*Topic)(nil) |
| 15 | 15 |
| 16 // NewTopic generates a new Subscritpion for a given project and topic name. | 16 // NewTopic generates a new Topic for a given project and topic name. |
|
dnj (Google)
2016/06/16 16:57:22
I like how this was the wrong word, and it was als
iannucci
2016/06/18 01:35:41
:D
| |
| 17 func NewTopic(project, name string) Topic { | 17 func NewTopic(project, name string) Topic { |
| 18 return Topic(newResource(project, "topics", name)) | 18 return Topic(newResource(project, "topics", name)) |
| 19 } | 19 } |
| 20 | 20 |
| 21 func (t *Topic) String() string { | 21 func (t *Topic) String() string { |
| 22 return string(*t) | 22 return string(*t) |
| 23 } | 23 } |
| 24 | 24 |
| 25 // Set implements flag.Value. | 25 // Set implements flag.Value. |
| 26 func (t *Topic) Set(value string) error { | 26 func (t *Topic) Set(value string) error { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 42 func (t Topic) Split() (p, n string) { | 42 func (t Topic) Split() (p, n string) { |
| 43 p, n, _ = t.SplitErr() | 43 p, n, _ = t.SplitErr() |
| 44 return | 44 return |
| 45 } | 45 } |
| 46 | 46 |
| 47 // SplitErr returns the Topic's project and name components. | 47 // SplitErr returns the Topic's project and name components. |
| 48 func (t Topic) SplitErr() (p, n string, err error) { | 48 func (t Topic) SplitErr() (p, n string, err error) { |
| 49 p, n, err = resourceProjectName(string(t)) | 49 p, n, err = resourceProjectName(string(t)) |
| 50 return | 50 return |
| 51 } | 51 } |
| OLD | NEW |