-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DP-5182 go-sdk: fusion traffic api adds 'type' parameter (#151)
* DP-5182 go-sdk: fusion traffic api adds 'type' parameter - cdn: add 'BandwidthOption' & 'FluxOption' struct - see https://jira.qiniu.io/browse/DP-5182 * cdn: remove useless printf line
- Loading branch information
Showing
5 changed files
with
130 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cdn | ||
|
||
//go:generate stringer -type DataType -linecomment | ||
type DataType int | ||
|
||
const ( | ||
// 静态cdn带宽(bps) | ||
DataTypeBandwidth DataType = iota + 1 // bandwidth | ||
// 302cdn带宽(bps) | ||
DataType302Bandwidth // 302bandwidth | ||
// 302MIX带宽(bps) | ||
DataType302mBandwidth // 302mbandwidth | ||
// 静态cdn流量(bytes) | ||
DataTypeFlow // flow | ||
// 302cdn流量(bytes) | ||
DataType302Flow // 302flow | ||
// 302MIX流量(bytes) | ||
DataType302mFlow // 302mflow | ||
) | ||
|
||
func DataTypeOf(datatype string) DataType { | ||
for d := DataTypeBandwidth; d <= DataType302mFlow; d++ { | ||
if d.String() == datatype { | ||
return d | ||
} | ||
} | ||
return -1 | ||
} | ||
|
||
func (d DataType) Valid() bool { | ||
return DataTypeBandwidth <= d && d <= DataType302mFlow | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package cdn | ||
|
||
type Option interface { | ||
Apply(opt interface{}) | ||
} | ||
|
||
type OptionFunc func(interface{}) | ||
|
||
func (f OptionFunc) Apply(opt interface{}) { | ||
f(opt) | ||
} |