qiniu

package
v0.0.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const Host = "https://api.qiniu.com"

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchFilesRequest added in v0.0.18

type BatchFilesRequest struct {
	// 操作类型,move/copy/restoreAr
	Type BatchFilesType
	// 需要移动/复制/解冻的源文件key
	SrcKeys []string
	// 移动/复制到的目标文件key
	DstKeys []string
	// 源文件所在桶
	SrcBucket *string
	// 目标文件所在桶
	DestBucket *string
	// 解冻文件天数
	AfterDay int
	// 是否强制覆盖
	Force bool
}

type BatchFilesType added in v0.0.18

type BatchFilesType string
const (
	BatchFilesTypeMove      BatchFilesType = "move"
	BatchFilesTypeCopy      BatchFilesType = "copy"
	BatchFilesTypeRestoreAr                = "restoreAr"
)

type Bsauth added in v0.0.29

type Bsauth struct {
	Path                           interface{}               `json:"path"`
	Method                         string                    `json:"method"`
	Parameters                     interface{}               `json:"parameters"`
	TimeLimit                      int                       `json:"timeLimit"`
	UserAuthURL                    string                    `json:"userAuthUrl"`
	Strict                         bool                      `json:"strict"`
	Enable                         bool                      `json:"enable"`
	SuccessStatusCode              int                       `json:"successStatusCode"`
	FailureStatusCode              int                       `json:"failureStatusCode"`
	IsQiniuPrivate                 bool                      `json:"isQiniuPrivate"`
	BackSourceWithResourcePath     bool                      `json:"backSourceWithResourcePath"`
	BackSourceWithoutClientHeaders bool                      `json:"backSourceWithoutClientHeaders"`
	ResponseWithSourceAuthCode     bool                      `json:"responseWithSourceAuthCode"`
	ResponseWithSourceAuthBody     bool                      `json:"responseWithSourceAuthBody"`
	UserAuthURLIPLimitConf         UserAuthURLIPLimitConf    `json:"userAuthUrlIpLimitConf"`
	UserAuthReqConf                UserAuthReqConf           `json:"userAuthReqConf"`
	UserAuthContentType            string                    `json:"userAuthContentType"`
	UserAuthRespBodyConf           UserAuthRespBodyConf      `json:"userAuthRespBodyConf"`
	UserBsauthResultCacheConf      UserBsauthResultCacheConf `json:"userBsauthResultCacheConf"`
	UserAuthMatchRuleConf          UserAuthMatchRuleConf     `json:"userAuthMatchRuleConf"`
}

type Cache added in v0.0.29

type Cache struct {
	CacheControls []CacheControls `json:"cacheControls"`
	IgnoreParam   bool            `json:"ignoreParam"`
	IgnoreParams  []interface{}   `json:"ignoreParams"`
	IncludeParams []interface{}   `json:"includeParams"`
}

type CacheControls added in v0.0.29

type CacheControls struct {
	Time     int    `json:"time"`
	Timeunit int    `json:"timeunit"`
	Type     string `json:"type"`
	Rule     string `json:"rule"`
}

type CdnClient added in v0.0.29

type CdnClient struct {
	// contains filtered or unexported fields
}

func NewCdnClient added in v0.0.29

func NewCdnClient(accessKey, secretKey string) *CdnClient

func (CdnClient) Flux added in v0.0.32

func (c CdnClient) Flux(req *FluxRequest) (*FluxResponse, error)

func (CdnClient) GetDomain added in v0.0.29

func (c CdnClient) GetDomain(request *GetDomainRequest) (*GetDomainResponse, error)

func (CdnClient) GetDomains added in v0.0.29

func (c CdnClient) GetDomains(req *GetDomainsRequest) (*GetDomainsResponse, error)

func (CdnClient) GetTopCountIp added in v0.0.32

func (c CdnClient) GetTopCountIp(req *GetTopCountIpRequest) (*GetTopCountIpResponse, error)

func (CdnClient) GetTopTrafficIp added in v0.0.32

func (c CdnClient) GetTopTrafficIp(req *GetTopTrafficIpRequest) (*GetTopTrafficIpResponse, error)

func (CdnClient) ModifyHttpsConf added in v0.0.29

func (c CdnClient) ModifyHttpsConf(req *ModifyHttpsConfRequest) (*ModifyHttpsConfResponse, error)

func (CdnClient) UpdateIpACL added in v0.0.32

func (c CdnClient) UpdateIpACL(req *UpdateIpACLRequest) (*UpdateIpACLResponse, error)

type Cert added in v0.0.29

type Cert struct {
	Certid string `json:"certid"`
	// 证书名称
	Name string `json:"name"`
	// 通用名称
	CommonName string `json:"common_name"`
	// DNS域名
	DnsNames []string `json:"dnsnames"`
	// 生效时间
	NotBefore int64 `json:"not_before"`
	// 过期时间
	NotAfter int64 `json:"not_after"`
	// 证书私钥
	Pri string `json:"pri"`
	// 证书内容
	Ca               string `json:"ca"`
	UID              int    `json:"uid"`
	CreateTime       int    `json:"create_time"`
	Orderid          string `json:"orderid"`
	ProductShortName string `json:"product_short_name"`
	ProductType      string `json:"product_type"`
	CertType         string `json:"cert_type"`
	Encrypt          string `json:"encrypt"`
	EncryptParameter string `json:"encryptParameter"`
	Enable           bool   `json:"enable"`
	ChildOrderID     string `json:"child_order_id"`
	State            string `json:"state"`
	AutoRenew        bool   `json:"auto_renew"`
	Renewable        bool   `json:"renewable"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a struct that represents a Qiniu client. It contains a Mac object for authentication, a CdnManager for CDN operations, and a BucketManager for bucket operations.

func NewClient

func NewClient(accessKey, secretKey string) *Client

NewClient is a function that creates a new Qiniu client. It takes an access key and a secret key as parameters, and returns a pointer to a Client object. The function creates a new Mac object with the access key and secret key, a new CdnManager with the Mac object, and a new BucketManager with the Mac object and a Config object that enables HTTPS. The function then creates a new Client object with the Mac object, the CdnManager, and the BucketManager, and returns a pointer to it.

func (Client) BatchFiles added in v0.0.18

func (c Client) BatchFiles(req *BatchFilesRequest) error

BatchFiles 批量移动/复制文件

func (Client) Delete

func (c Client) Delete(bucket, key string) error

Delete is a method of Client that deletes a specified file. It takes a string representing the bucket where the file is located and a string representing the key of the file as parameters. The method calls the Delete method of the BucketManager object in the Client, passing the bucket and the key. The method returns an error if the Delete method of the BucketManager returns an error.

func (Client) GetTimestampSignUrl added in v0.0.14

func (c Client) GetTimestampSignUrl(urlPath url.URL, secretKey string, expiration time.Duration) string

func (Client) GetUploadToken

func (c Client) GetUploadToken(putPolicy storage.PutPolicy) string

GetUploadToken is a method of Client that gets an upload token. It takes a PutPolicy object as a parameter. The method calls the UploadToken method of the PutPolicy object, passing the Mac object in the Client. The method returns the upload token as a string.

func (Client) ListFiles added in v0.0.10

func (c Client) ListFiles(bucket, prefix, delimiter, marker string, limit int) ([]storage.ListItem, []string, string, bool, error)

ListFiles 列举文件,每次最大1000

func (Client) MakePublicUrl added in v0.0.10

func (c Client) MakePublicUrl(domain, key string) string

MakePublicUrl 公开空间访问链接

func (Client) PutFile

func (c Client) PutFile(ctx context.Context, req *PutFileRequest) (*PutRet, error)

PutFile 上传文件

func (Client) RefreshUrls

func (c Client) RefreshUrls(urlsToRefresh []string) error

RefreshUrls is a method of Client that refreshes the cache of the specified URLs. It takes a slice of strings representing the URLs to refresh as a parameter. The method calls the RefreshUrls method of the CdnManager object in the Client, passing the URLs to refresh. The method returns an error if the RefreshUrls method of the CdnManager returns an error.

func (Client) VerifyCallback added in v0.0.21

func (c Client) VerifyCallback(req *http.Request) (bool, error)

VerifyCallback 验证上传回调请求是否来自七牛

type CreateSslCertRequest added in v0.0.29

type CreateSslCertRequest struct {
	// 证书名称
	Name       string `json:"name"`
	CommonName string `json:"common_name"`
	Pri        string `json:"pri"`
	Ca         string `json:"ca"`
}

type CreateSslCertResponse added in v0.0.29

type CreateSslCertResponse struct {
	// 证书ID
	CertID string `json:"certID"`
	Code   int    `json:"code"`
	Error  string `json:"error"`
}

type DeliveryBucketFop added in v0.0.29

type DeliveryBucketFop struct {
	Enable           bool        `json:"enable"`
	SufyDeliveryHost string      `json:"sufyDeliveryHost"`
	NewStyle         interface{} `json:"newStyle"`
	DeleteStyleNames interface{} `json:"deleteStyleNames"`
	NewSeparator     interface{} `json:"newSeparator"`
}

type Domains added in v0.0.29

type Domains struct {
	Name               string `json:"name"`
	Type               string `json:"type"`
	Cname              string `json:"cname"`
	TestURLPath        string `json:"testURLPath"`
	Platform           string `json:"platform"`
	GeoCover           string `json:"geoCover"`
	Protocol           string `json:"protocol"`
	OperatingState     string `json:"operatingState"`
	OperatingStateDesc string `json:"operatingStateDesc"`
	CreateAt           string `json:"createAt"`
	ModifyAt           string `json:"modifyAt"`
}

type External added in v0.0.29

type External struct {
	EnableFop bool      `json:"enableFop"`
	ImageSlim ImageSlim `json:"imageSlim"`
}

type FluxRequest added in v0.0.32

type FluxRequest struct {
	// 开始日期,例如:2016-07-01
	StartDate string `json:"startDate"`
	// 结束日期,例如:2016-07-03
	EndDate string `json:"endDate"`
	// 时间粒度,取值为5min/hour/day
	Granularity string `json:"granularity"`
	// 域名列表,以 ;分割
	Domains string `json:"domains"`
}

type FluxResponse added in v0.0.32

type FluxResponse struct {
	Code  int                             `json:"code"`
	Error string                          `json:"error"`
	Time  []string                        `json:"time"`
	Data  map[string]FluxResponseDataItem `json:"data"`
}

type FluxResponseDataItem added in v0.0.32

type FluxResponseDataItem struct {
	China   []int64 `json:"china"`
	Oversea []int64 `json:"oversea"`
}

type GetDomainRequest added in v0.0.29

type GetDomainRequest struct {
	Name string
}

type GetDomainResponse added in v0.0.29

type GetDomainResponse struct {
	Name                   string            `json:"name"`
	PareDomain             string            `json:"pareDomain"`
	Type                   string            `json:"type"`
	Cname                  string            `json:"cname"`
	TestURLPath            string            `json:"testURLPath"`
	Protocol               string            `json:"protocol"`
	Platform               string            `json:"platform"`
	Product                string            `json:"product"`
	GeoCover               string            `json:"geoCover"`
	QiniuPrivate           bool              `json:"qiniuPrivate"`
	OperationType          string            `json:"operationType"`
	OperatingState         string            `json:"operatingState"`
	OperatingStateDesc     string            `json:"operatingStateDesc"`
	FreezeType             string            `json:"freezeType"`
	CreateAt               time.Time         `json:"createAt"`
	ModifyAt               time.Time         `json:"modifyAt"`
	CouldOperateBySelf     bool              `json:"couldOperateBySelf"`
	UIDIsFreezed           bool              `json:"uidIsFreezed"`
	OemMail                string            `json:"oemMail"`
	TagList                interface{}       `json:"tagList"`
	KvTagList              interface{}       `json:"kvTagList"`
	IPTypes                int               `json:"ipTypes"`
	DeliveryBucket         string            `json:"deliveryBucket"`
	DeliveryBucketType     string            `json:"deliveryBucketType"`
	DeliveryBucketFop      DeliveryBucketFop `json:"deliveryBucketFop"`
	IsSufy                 bool              `json:"isSufy"`
	IsPcdnBackup           bool              `json:"isPcdnBackup"`
	IsPcdnBackup302        bool              `json:"isPcdnBackup302"`
	Source                 Source            `json:"source"`
	Bsauth                 Bsauth            `json:"bsauth"`
	External               External          `json:"external"`
	Cache                  Cache             `json:"cache"`
	Referer                Referer           `json:"referer"`
	TimeACL                TimeACL           `json:"timeACL"`
	IPACL                  IPACL             `json:"ipACL"`
	UaACL                  interface{}       `json:"uaACL"`
	RequestHeaders         interface{}       `json:"requestHeaders"`
	ResponseHeaderControls []interface{}     `json:"responseHeaderControls"`
	HTTPS                  HTTPS             `json:"https"`
	RegisterNo             string            `json:"registerNo"`
	ConfigProcessRaTio     int               `json:"configProcessRa   tio"`
	HurryUpFreecert        bool              `json:"hurryUpFreecert"`
	HTTPSOPTime            time.Time         `json:"httpsOPTime"`
	Range                  Range             `json:"range"`
	OperTaskID             string            `json:"operTaskId"`
	OperTaskType           string            `json:"operTaskType"`
	OperTaskErrCode        int               `json:"operTaskErrCode"`
}

type GetDomainsRequest added in v0.0.29

type GetDomainsRequest struct {
	// 域名前缀
	Marker string `json:"marker,omitempty"`
	// 返回的最大域名个数。1~1000, 不填默认为 10
	Limit int `json:"limit,omitempty"`
}

type GetDomainsResponse added in v0.0.29

type GetDomainsResponse struct {
	Marker  string    `json:"marker"`
	Domains []Domains `json:"domains"`
}

type GetSslCertRequest added in v0.0.29

type GetSslCertRequest struct {
	CertID string
}

type GetSslCertResponse added in v0.0.29

type GetSslCertResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
	Cert  Cert   `json:"cert"`
}

type GetTopCountIpRequest added in v0.0.32

type GetTopCountIpRequest struct {
	Domains   []string `json:"domains"`
	Region    string   `json:"region"`
	StartDate string   `json:"startDate"`
	EndDate   string   `json:"endDate"`
}

type GetTopCountIpResponse added in v0.0.32

type GetTopCountIpResponse struct {
	Code  int                       `json:"code"`
	Error string                    `json:"error"`
	Data  GetTopCountIpResponseData `json:"data"`
}

type GetTopCountIpResponseData added in v0.0.32

type GetTopCountIpResponseData struct {
	Count []int64  `json:"count"`
	Ips   []string `json:"ips"`
}

type GetTopTrafficIpRequest added in v0.0.32

type GetTopTrafficIpRequest struct {
	Domains   []string `json:"domains"`
	Region    string   `json:"region"`
	StartDate string   `json:"startDate"`
	EndDate   string   `json:"endDate"`
}

type GetTopTrafficIpResponse added in v0.0.32

type GetTopTrafficIpResponse struct {
	Code  int                         `json:"code"`
	Error string                      `json:"error"`
	Data  GetTopTrafficIpResponseData `json:"data"`
}

type GetTopTrafficIpResponseData added in v0.0.32

type GetTopTrafficIpResponseData struct {
	Traffic []int64  `json:"traffic"`
	Ips     []string `json:"ips"`
}

type HTTPS added in v0.0.29

type HTTPS struct {
	CertID      string `json:"certId"`
	ForceHTTPS  bool   `json:"forceHttps"`
	HTTP2Enable bool   `json:"http2Enable"`
	FreeCert    bool   `json:"freeCert"`
}

type IPACL added in v0.0.29

type IPACL struct {
	IPACLType   string   `json:"ipACLType"`
	IPACLValues []string `json:"ipACLValues"`
}

type ImageSlim added in v0.0.29

type ImageSlim struct {
	EnableImageSlim  bool          `json:"enableImageSlim"`
	PrefixImageSlims []interface{} `json:"prefixImageSlims"`
	RegexpImageSlims []interface{} `json:"regexpImageSlims"`
}

type ModifyHttpsConfRequest added in v0.0.29

type ModifyHttpsConfRequest struct {
	// 域名
	Name string `json:"-"`
	// 证书id,从上传或者获取证书列表里拿到证书id
	CertID string `json:"certId"`
	// 是否强制https跳转
	ForceHttps bool `json:"forceHttps"`
	// http2功能是否启用,false为关闭,true为开启
	Http2Enable bool `json:"http2Enable"`
}

type ModifyHttpsConfResponse added in v0.0.29

type ModifyHttpsConfResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}

type PutFileRequest added in v0.0.18

type PutFileRequest struct {
	// 上传桶
	Bucket string
	// 上传文件key
	Key string
	// 上传文件内容,Data和LocalFile必须有一个不为nil
	Data []byte
	// 本地文件路径
	LocalFile *string
	// 文件上传的上传策略
	PutPolicy storage.PutPolicy
	// 文件上传,资源管理等配置
	Config *storage.Config
	// 表示分片上传
	Extra *storage.PutExtra
}

type PutRet added in v0.0.18

type PutRet struct {
	Key          string `json:"key"`
	Hash         string `json:"hash"`
	Fsize        int64  `json:"fsize"`
	PersistentID string `json:"persistentId"`
}

type Range added in v0.0.29

type Range struct {
	Enable string `json:"enable"`
}

type Referer added in v0.0.29

type Referer struct {
	RefererType   string        `json:"refererType"`
	RefererValues []interface{} `json:"refererValues"`
	NullReferer   bool          `json:"nullReferer"`
}

type Request added in v0.0.32

type Request struct {
	Method      string
	ApiUrl      string
	Body        []byte
	Credentials *auth.Credentials
}

type SmsClient

type SmsClient struct {
	// contains filtered or unexported fields
}

func NewSmsClient

func NewSmsClient(accessKey, secretKey string) *SmsClient

func (SmsClient) SendMessage

func (c SmsClient) SendMessage(signatureId, templateId string, mobiles []string, parameters map[string]interface{}) (*string, error)

type Source added in v0.0.29

type Source struct {
	SourceCname                  string         `json:"sourceCname"`
	SourceType                   string         `json:"sourceType"`
	SourceHost                   string         `json:"sourceHost"`
	TestSourceHost               string         `json:"testSourceHost"`
	SourceIPs                    []string       `json:"sourceIPs"`
	SourceDomain                 string         `json:"sourceDomain"`
	SourceQiniuBucket            string         `json:"sourceQiniuBucket"`
	SourceURLScheme              string         `json:"sourceURLScheme"`
	AdvancedSources              interface{}    `json:"advancedSources"`
	SkipCheckSource              bool           `json:"skipCheckSource"`
	TransferConf                 interface{}    `json:"transferConf"`
	SourceTimeACL                bool           `json:"sourceTimeACL"`
	SourceTimeACLKeys            interface{}    `json:"sourceTimeACLKeys"`
	MaxSourceRate                int            `json:"maxSourceRate"`
	MaxSourceConcurrency         int            `json:"maxSourceConcurrency"`
	AddRespHeader                interface{}    `json:"addRespHeader"`
	URLRewrites                  interface{}    `json:"urlRewrites"`
	SourceRetryCodes             interface{}    `json:"sourceRetryCodes"`
	FollowRedirect               bool           `json:"followRedirect"`
	Redirect30X                  interface{}    `json:"redirect30x"`
	SourceRequestHeaderControls  interface{}    `json:"sourceRequestHeaderControls"`
	SourceResponseHeaderControls interface{}    `json:"sourceResponseHeaderControls"`
	MaxSourceRatePerIDC          int            `json:"maxSourceRatePerIDC"`
	MaxSourceConcurrencyPerIDC   int            `json:"maxSourceConcurrencyPerIDC"`
	TestURLPath                  string         `json:"testURLPath"`
	SourceIgnoreParams           []interface{}  `json:"sourceIgnoreParams"`
	SourceIgnoreAllParams        bool           `json:"sourceIgnoreAllParams"`
	Range                        Range          `json:"range"`
	EnableSourceAuth             bool           `json:"enableSourceAuth"`
	SourceAuthInfo               SourceAuthInfo `json:"sourceAuthInfo"`
}

type SourceAuthInfo added in v0.0.29

type SourceAuthInfo struct {
	OssProvider     string `json:"ossProvider"`
	AccessKeyID     string `json:"accessKeyId"`
	AccessKeySecret string `json:"accessKeySecret"`
}

type SslClient added in v0.0.29

type SslClient struct {
	// contains filtered or unexported fields
}

func NewSslClient added in v0.0.29

func NewSslClient(accessKey, secretKey string) *SslClient

func (SslClient) CreateSslCert added in v0.0.29

func (s SslClient) CreateSslCert(ctx context.Context, request *CreateSslCertRequest) (*CreateSslCertResponse, error)

CreateSslCert 上传证书

func (SslClient) GetSslCert added in v0.0.29

func (s SslClient) GetSslCert(ctx context.Context, request *GetSslCertRequest) (*GetSslCertResponse, error)

GetSslCert 用户获取单个证书的接口

type TimeACL added in v0.0.29

type TimeACL struct {
	Enable                bool         `json:"enable"`
	TimeACLKeys           interface{}  `json:"timeACLKeys"`
	AuthType              string       `json:"authType"`
	AuthDelta             int          `json:"authDelta"`
	SufyTimeACLKeys       interface{}  `json:"sufyTimeACLKeys"`
	SufyCallbackBody      interface{}  `json:"sufyCallbackBody"`
	CheckURL              string       `json:"checkUrl"`
	AdvanceFunctionEnable bool         `json:"advanceFunctionEnable"`
	RuleType              string       `json:"ruleType"`
	Rules                 interface{}  `json:"rules"`
	Params                interface{}  `json:"params"`
	ParamStr              string       `json:"paramStr"`
	ToLowerCase           string       `json:"toLowerCase"`
	URLEncode             string       `json:"urlEncode"`
	HashMethod            string       `json:"hashMethod"`
	Verification          Verification `json:"verification"`
}

type UpdateIpACLRequest added in v0.0.32

type UpdateIpACLRequest struct {
	Domain string
	IpAcl  IPACL
}

type UpdateIpACLResponse added in v0.0.32

type UpdateIpACLResponse struct{}

type UserAuthMatchRuleConf added in v0.0.29

type UserAuthMatchRuleConf struct {
	Type string `json:"type"`
	Rule string `json:"rule"`
}

type UserAuthReqConf added in v0.0.29

type UserAuthReqConf struct {
	Body                       interface{} `json:"body"`
	Header                     interface{} `json:"header"`
	Urlquery                   interface{} `json:"urlquery"`
	IncludeClientHeadersInBody bool        `json:"includeClientHeadersInBody"`
}

type UserAuthRespBodyConf added in v0.0.29

type UserAuthRespBodyConf struct {
	Enable                 bool        `json:"enable"`
	ContentType            string      `json:"contentType"`
	SuccessConditions      interface{} `json:"successConditions"`
	SuccessLogicalOperator string      `json:"successLogicalOperator"`
	FailureConditions      interface{} `json:"failureConditions"`
	FailureLogicalOperator string      `json:"failureLogicalOperator"`
}

type UserAuthURLIPLimitConf added in v0.0.29

type UserAuthURLIPLimitConf struct {
	Enable   bool `json:"enable"`
	Limit    int  `json:"limit"`
	TimeSlot int  `json:"timeSlot"`
}

type UserBsauthResultCacheConf added in v0.0.29

type UserBsauthResultCacheConf struct {
	CacheEnable     bool        `json:"cacheEnable"`
	CacheSingleType string      `json:"cacheSingleType"`
	CacheKeyElems   interface{} `json:"cacheKeyElems"`
	CacheShareHost  string      `json:"cacheShareHost"`
	CacheDuration   int         `json:"cacheDuration"`
}

type Verification added in v0.0.29

type Verification struct {
	Name     string `json:"name"`
	Locate   string `json:"locate"`
	FailCode int    `json:"failCode"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL