Skip to content

Commit

Permalink
Updates features in bos and cce
Browse files Browse the repository at this point in the history
  • Loading branch information
duanliguo committed Oct 24, 2024
1 parent 885af32 commit 5a9c816
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bce/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

// Constants and default values for the package bce
const (
SDK_VERSION = "0.9.195"
SDK_VERSION = "0.9.196"
URI_PREFIX = "/" // now support uri without prefix "v1" so just set root path
DEFAULT_DOMAIN = "baidubce.com"
DEFAULT_PROTOCOL = "http"
Expand Down
1 change: 1 addition & 0 deletions http/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (

// BOS HTTP Headers
BCE_COPY_METADATA_DIRECTIVE = "x-bce-metadata-directive"
BCE_COPY_TAGGING_DIRECTIVE = "x-bce-tagging-directive"
BCE_COPY_SOURCE = "x-bce-copy-source"
BCE_COPY_SOURCE_IF_MATCH = "x-bce-copy-source-if-match"
BCE_COPY_SOURCE_IF_MODIFIED_SINCE = "x-bce-copy-source-if-modified-since"
Expand Down
27 changes: 22 additions & 5 deletions services/bcm/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,28 @@ type EventDataRequest struct {
}

type CloudEventResponse struct {
PageNo int `json:"pageNo,omitempty"`
PageSize int `json:"pageSize,omitempty"`
TotalCount int `json:"totalCount,omitempty"`
TotalPage int `json:"totalPage,omitempty"`
Result []CloudEvent `json:"result,omitempty"`
PageNumber int `json:"pageNumber,omitempty"`
PageSize int `json:"pageSize,omitempty"`
PageElements int `json:"pageElements,omitempty"`
Last bool `json:"last,omitempty"`
First bool `json:"first,omitempty"`
TotalPages bool `json:"totalPages,omitempty"`
TotalElements int `json:"totalElements,omitempty"`
Content []CloudEventData `json:"content,omitempty"`
}

type CloudEventData struct {
AccountID string `json:"accountId,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
Region string `json:"region,omitempty"`
ResourceType string `json:"resourceType,omitempty"`
ResourceID string `json:"resourceId,omitempty"`
EventID string `json:"eventId,omitempty"`
EventType string `json:"eventType,omitempty"`
EventLevel string `json:"eventLevel,omitempty"`
EventAlias string `json:"eventAlias,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Content string `json:"content,omitempty"`
}

type CloudEvent struct {
Expand Down
5 changes: 5 additions & 0 deletions services/bos/api/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,13 @@ type CopyObjectArgs struct {
IfUnmodifiedSince string
TrafficLimit int64
CannedAcl string
TaggingDirective string
}

type MultiCopyObjectArgs struct {
StorageClass string
ObjectTagging string
TaggingDirective string
}

type CallbackResult struct {
Expand Down Expand Up @@ -456,6 +459,8 @@ type InitiateMultipartUploadArgs struct {
ContentDisposition string
Expires string
StorageClass string
ObjectTagging string
TaggingDirective string
}

// InitiateMultipartUploadResult defines the result structure to initiate a multipart upload.
Expand Down
8 changes: 8 additions & 0 deletions services/bos/api/multipart.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ func InitiateMultipartUpload(cli bce.Client, bucket, object, contentType string,
args.StorageClass)
}
}
if len(args.ObjectTagging) != 0 {
if ok, encodeTagging := validObjectTagging(args.ObjectTagging); ok {
req.SetHeader(http.BCE_OBJECT_TAGGING, encodeTagging)
}
}
if validMetadataDirective(args.TaggingDirective) {
req.SetHeader(http.BCE_COPY_TAGGING_DIRECTIVE, args.TaggingDirective)
}
}

// Send request and get the result
Expand Down
3 changes: 3 additions & 0 deletions services/bos/api/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ func CopyObject(cli bce.Client, bucket, object, source string,
"invalid metadata directive value: " + args.MetadataDirective)
}
}
if validMetadataDirective(args.TaggingDirective) {
req.SetHeader(http.BCE_COPY_TAGGING_DIRECTIVE, args.TaggingDirective)
}
if validStorageClass(args.StorageClass) {
req.SetHeader(http.BCE_STORAGE_CLASS, args.StorageClass)
} else {
Expand Down
2 changes: 2 additions & 0 deletions services/bos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,8 @@ func (c *Client) ParallelCopy(srcBucketName string, srcObjectName string,
ContentDisposition: objectMeta.ContentDisposition,
Expires: objectMeta.Expires,
StorageClass: objectMeta.StorageClass,
ObjectTagging: args.ObjectTagging,
TaggingDirective: args.TaggingDirective,
}
if args != nil {
if len(args.StorageClass) != 0 {
Expand Down
7 changes: 5 additions & 2 deletions services/cce/v2/types/instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ type InstanceGroupSpec struct {

CleanPolicy CleanPolicy `json:"cleanPolicy,omitempty" `

InstanceTemplate InstanceTemplate `json:"instanceTemplate" `
Replicas int `json:"replicas" `
// Deprecated: Use InstanceTemplates instead.
InstanceTemplate InstanceTemplate `json:"instanceTemplate" `
InstanceTemplates []InstanceTemplate `json:"instanceTemplates,omitempty" `

Replicas int `json:"replicas" `

ClusterAutoscalerSpec *ClusterAutoscalerSpec `json:"clusterAutoscalerSpec,omitempty" `
}
Expand Down

0 comments on commit 5a9c816

Please sign in to comment.