@@ -3,6 +3,8 @@ package sls
33import (
44 "net/http"
55 "time"
6+
7+ "github.com/aliyun/aliyun-log-go-sdk/util"
68)
79
810// CreateNormalInterface create a normal client.
@@ -11,10 +13,10 @@ import (
1113// If you keep using long-lived AccessKeyID and AccessKeySecret,
1214// use the example code below.
1315//
14- // provider := NewStaticCredProvider (accessKeyID, accessKeySecret, securityToken)
16+ // provider := NewStaticCredentialsProvider (accessKeyID, accessKeySecret, securityToken)
1517// client := CreateNormalInterfaceV2(endpoint, provider)
1618func CreateNormalInterface (endpoint , accessKeyID , accessKeySecret , securityToken string ) ClientInterface {
17- return & Client {
19+ client := & Client {
1820 Endpoint : endpoint ,
1921 AccessKeyID : accessKeyID ,
2022 AccessKeySecret : accessKeySecret ,
@@ -26,6 +28,8 @@ func CreateNormalInterface(endpoint, accessKeyID, accessKeySecret, securityToken
2628 securityToken ,
2729 ),
2830 }
31+ client .setSignV4IfInAcdr (endpoint )
32+ return client
2933}
3034
3135// CreateNormalInterfaceV2 create a normal client, with a CredentialsProvider.
@@ -35,13 +39,15 @@ func CreateNormalInterface(endpoint, accessKeyID, accessKeySecret, securityToken
3539//
3640// See [credentials_provider.go] for more details.
3741func CreateNormalInterfaceV2 (endpoint string , credentialsProvider CredentialsProvider ) ClientInterface {
38- return & Client {
42+ client := & Client {
3943 Endpoint : endpoint ,
4044 credentialsProvider : credentialsProvider ,
4145 }
46+ client .setSignV4IfInAcdr (endpoint )
47+ return client
4248}
4349
44- type UpdateTokenFunction = func () ( accessKeyID , accessKeySecret , securityToken string , expireTime time. Time , err error )
50+ type UpdateTokenFunction = util. UpdateTokenFunction
4551
4652// CreateTokenAutoUpdateClient create a TokenAutoUpdateClient,
4753// this client will auto fetch security token and retry when operation is `Unauthorized`
@@ -79,6 +85,8 @@ type ClientInterface interface {
7985 SetUserAgent (userAgent string )
8086 // SetHTTPClient set a custom http client, all request will send to sls by this client
8187 SetHTTPClient (client * http.Client )
88+ // SetRetryTimeout set retry timeout, client will retry util retry timeout
89+ SetRetryTimeout (timeout time.Duration )
8290 // #################### Client Operations #####################
8391 // ResetAccessKeyToken reset client's access key token
8492 ResetAccessKeyToken (accessKeyID , accessKeySecret , securityToken string )
@@ -162,6 +170,20 @@ type ClientInterface interface {
162170 // ListEventStore returns all eventStore names of project p.
163171 ListEventStore (project string , offset , size int ) ([]string , error )
164172
173+ // #################### StoreView Operations #####################
174+ // CreateStoreView creates a new storeView.
175+ CreateStoreView (project string , storeView * StoreView ) error
176+ // UpdateStoreView updates a storeView.
177+ UpdateStoreView (project string , storeView * StoreView ) error
178+ // DeleteStoreView deletes a storeView.
179+ DeleteStoreView (project string , storeViewName string ) error
180+ // GetStoreView returns storeView.
181+ GetStoreView (project string , storeViewName string ) (* StoreView , error )
182+ // ListStoreViews returns all storeView names of a project.
183+ ListStoreViews (project string , req * ListStoreViewsRequest ) (* ListStoreViewsResponse , error )
184+ // GetStoreViewIndex returns all index config of logstores in the storeView, only support storeType logstore.
185+ GetStoreViewIndex (project string , storeViewName string ) (* GetStoreViewIndexResponse , error )
186+
165187 // #################### Logtail Operations #####################
166188 // ListMachineGroup returns machine group name list and the total number of machine groups.
167189 // The offset starts from 0 and the size is the max number of machine groups could be returned.
@@ -220,7 +242,6 @@ type ClientInterface interface {
220242 CreateEtlMeta (project string , etlMeta * EtlMeta ) (err error )
221243 UpdateEtlMeta (project string , etlMeta * EtlMeta ) (err error )
222244 DeleteEtlMeta (project string , etlMetaName , etlMetaKey string ) (err error )
223- listEtlMeta (project string , etlMetaName , etlMetaKey , etlMetaTag string , offset , size int ) (total int , count int , etlMeta []* EtlMeta , err error )
224245 GetEtlMeta (project string , etlMetaName , etlMetaKey string ) (etlMeta * EtlMeta , err error )
225246 ListEtlMeta (project string , etlMetaName string , offset , size int ) (total int , count int , etlMetaList []* EtlMeta , err error )
226247 ListEtlMetaWithTag (project string , etlMetaName , etlMetaTag string , offset , size int ) (total int , count int , etlMetaList []* EtlMeta , err error )
@@ -237,12 +258,14 @@ type ClientInterface interface {
237258 MergeShards (project , logstore string , shardID int ) (shards []* Shard , err error )
238259
239260 // #################### Log Operations #####################
261+ PutLogsWithMetricStoreURL (project , logstore string , lg * LogGroup ) (err error )
240262 // PutLogs put logs into logstore.
241263 // The callers should transform user logs into LogGroup.
242264 PutLogs (project , logstore string , lg * LogGroup ) (err error )
243265 // PostLogStoreLogs put logs into Shard logstore by hashKey.
244266 // The callers should transform user logs into LogGroup.
245267 PostLogStoreLogs (project , logstore string , lg * LogGroup , hashKey * string ) (err error )
268+ PostLogStoreLogsV2 (project , logstore string , req * PostLogStoreLogsRequest ) (err error )
246269 // PostRawLogWithCompressType put logs into logstore with specific compress type and hashKey.
247270 PostRawLogWithCompressType (project , logstore string , rawLogData []byte , compressType int , hashKey * string ) (err error )
248271 // PutLogsWithCompressType put logs into logstore with specific compress type.
@@ -262,14 +285,18 @@ type ClientInterface interface {
262285 // The nextCursor is the next curosr can be used to read logs at next time.
263286 GetLogsBytes (project , logstore string , shardID int , cursor , endCursor string ,
264287 logGroupMaxCount int ) (out []byte , nextCursor string , err error )
288+ // Deprecated: Use GetLogsBytesWithQuery instead.
265289 GetLogsBytesV2 (plr * PullLogRequest ) (out []byte , nextCursor string , err error )
290+ GetLogsBytesWithQuery (plr * PullLogRequest ) (out []byte , plm * PullLogMeta , err error )
266291 // PullLogs gets logs from shard specified by shardId according cursor and endCursor.
267292 // The logGroupMaxCount is the max number of logGroup could be returned.
268293 // The nextCursor is the next cursor can be used to read logs at next time.
269294 // @note if you want to pull logs continuous, set endCursor = ""
270295 PullLogs (project , logstore string , shardID int , cursor , endCursor string ,
271296 logGroupMaxCount int ) (gl * LogGroupList , nextCursor string , err error )
297+ // Deprecated: Use PullLogsWithQuery instead.
272298 PullLogsV2 (plr * PullLogRequest ) (gl * LogGroupList , nextCursor string , err error )
299+ PullLogsWithQuery (plr * PullLogRequest ) (gl * LogGroupList , plm * PullLogMeta , err error )
273300 // GetHistograms query logs with [from, to) time range
274301 GetHistograms (project , logstore string , topic string , from int64 , to int64 , queryExp string ) (* GetHistogramsResponse , error )
275302 // GetLogs query logs with [from, to) time range
0 commit comments