aliyun

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliOss

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

AliOss is a struct that holds the client and bucket information for interacting with Aliyun OSS.

func NewAliOss

func NewAliOss(endpoint, accessKeyId, accessKeySecret, bucketName string) (*AliOss, error)

NewAliOss creates a new instance of AliOss. It takes the endpoint, accessKeyId, accessKeySecret, and bucketName as parameters. It returns a pointer to the created AliOss instance and an error if any occurred during the creation.

func (AliOss) DeleteObjects

func (a AliOss) DeleteObjects(objects []string) error

DeleteObjects deletes files from the OSS bucket. It takes a list of object names as a parameter and returns an error if the delete operation fails.

func (AliOss) GetPolicyToken added in v0.0.25

func (a AliOss) GetPolicyToken(expireSeconds int64, ossHost string, directoryPrefix string, callBackUrl string) ([]byte, error)

GetPolicyToken generates a policy token for uploading files to the OSS bucket. expireSeconds Token有效期,单位秒. ossHost OSS域名,"http://bucket-name.oss-cn-hangzhou.aliyuncs.com" directoryPrefix 上传目录前缀. callBackUrl 上传回调地址.

func (AliOss) GetSignUrl

func (a AliOss) GetSignUrl(objectName string) (string, error)

GetSignUrl generates a signed URL for a file in the OSS bucket. It takes the objectName as a parameter and returns the signed URL and an error if the operation fails.

func (AliOss) ListObjects

func (a AliOss) ListObjects(prefix string) ([]oss.ObjectProperties, error)

ListObjects lists the files in the OSS bucket. It takes a prefix as a parameter and returns a list of ObjectProperties and an error if the operation fails.

func (AliOss) MakePublicURL

func (a AliOss) MakePublicURL(domain, key string) (finalUrl string)

MakePublicURL generates a public URL for a file in the OSS bucket. It takes the domain and key as parameters and returns the generated URL.

func (AliOss) Move added in v0.0.24

func (a AliOss) Move(srcObjectKey, destObjectKey string, options ...oss.Option) error

Move moves a file within the OSS bucket. It takes the source object key, destination object key, and options as parameters. It returns an error if the move operation fails.

func (AliOss) PutObject

func (a AliOss) PutObject(objectName string, reader io.Reader, options ...oss.Option) error

PutObject uploads a file to OSS. It takes the objectName, reader, and options as parameters. It returns an error if the upload operation fails.

func (AliOss) SignUrl

func (a AliOss) SignUrl(req *SignUrlRequest) (string, error)

SignUrl generates a signed URL for a file in the OSS bucket. It takes a SignUrlRequest as a parameter and returns the signed URL and an error if the operation fails.

func (AliOss) VerifyCallbackSignature added in v0.0.25

func (a AliOss) VerifyCallbackSignature(r *http.Request) error

VerifyCallbackSignature 校验回调请求的签名是否合法

type CallbackParam added in v0.0.25

type CallbackParam struct {
	CallbackUrl      string `json:"callbackUrl"`
	CallbackBody     string `json:"callbackBody"`
	CallbackBodyType string `json:"callbackBodyType"`
}

type CdnClient added in v0.0.29

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

func NewCdnClient added in v0.0.29

func NewCdnClient(config *openapi.Config) (*CdnClient, error)

func (CdnClient) DescribeCdnDomainDetail added in v0.0.29

DescribeCdnDomainDetail 查询指定加速域名的基本配置

func (CdnClient) DescribeDomainCertificateInfoWithOptions added in v0.0.29

DescribeDomainCertificateInfoWithOptions 查询域名证书信息

func (CdnClient) DescribeUserDomainsWithOptions added in v0.0.29

DescribeUserDomainsWithOptions 查询用户名下所有的域名与状态,支持域名模糊匹配过滤和域名状态过滤

func (CdnClient) SetCdnDomainSSLCertificate added in v0.0.29

type ConfigStruct added in v0.0.25

type ConfigStruct struct {
	Expiration string     `json:"expiration"`
	Conditions [][]string `json:"conditions"`
}

type DCdnClient added in v0.0.29

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

func NewDCdnClient added in v0.0.29

func NewDCdnClient(config *openapi.Config) (*DCdnClient, error)

func (DCdnClient) DescribeDcdnDomainCertificateInfoWithOptions added in v0.0.29

DescribeDcdnDomainCertificateInfoWithOptions 查询指定域名证书信息

func (DCdnClient) DescribeDcdnDomainDetailWithOptions added in v0.0.29

DescribeDcdnDomainDetailWithOptions 获取指定加速域名配置的基本信息

func (DCdnClient) DescribeDcdnUserDomainsWithOptions added in v0.0.29

DescribeDcdnUserDomainsWithOptions 查询用户名下所有的DCDN域名,支持域名模糊匹配过滤和域名状态过滤

type DnsClient added in v0.0.29

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

func NewDnsClient added in v0.0.29

func NewDnsClient(config *openapi.Config) (*DnsClient, error)

func (DnsClient) DescribeDomains added in v0.0.29

func (d DnsClient) DescribeDomains(describeDomainsRequest *alidns20150109.DescribeDomainsRequest, runtime *util.RuntimeOptions) (*alidns20150109.DescribeDomainsResponse, error)

DescribeDomains 获取域名列表

type DocMindClient added in v0.0.24

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

DocMindClient is a struct that holds a client instance for interacting with the DocMind API.

func NewDocMindClient added in v0.0.24

func NewDocMindClient(accessKeyId, accessKeySecret, endpoint string) (*DocMindClient, error)

NewDocMindClient is a function that initializes a new DocMindClient. It takes in an accessKeyId, accessKeySecret, and endpoint as parameters. It returns a pointer to a DocMindClient and an error.

func (DocMindClient) GetDocumentConvertResult added in v0.0.24

func (d DocMindClient) GetDocumentConvertResult(requestId string) (*client.GetDocumentConvertResultResponse, error)

GetDocumentConvertResult is a method on the DocMindClient struct that retrieves the result of a document conversion job. It takes in a requestId as a parameter, which is the ID of the job to retrieve the result for. It returns a pointer to a GetDocumentConvertResultResponse and an error. https://help.aliyun.com/zh/document-mind/developer-reference/convertpdftoword?spm=a2c4g.11186623.0.0.778453cedQWluW#fba5587e2duz1

func (DocMindClient) SubmitConvertPdfToWordJobAdvance added in v0.0.24

func (d DocMindClient) SubmitConvertPdfToWordJobAdvance(fileName string, reader io.Reader) (*client.SubmitConvertPdfToWordJobResponse, error)

SubmitConvertPdfToWordJobAdvance is a method on the DocMindClient struct that submits a job to convert a PDF to a Word document. It takes in a fileName and a reader as parameters. The reader is expected to be a stream of the PDF file. It returns a pointer to a SubmitConvertPdfToWordJobResponse and an error.

type GreenClient

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

GreenClient is a struct that holds the client information for interacting with Alibaba Cloud's Green service.

func NewGreenClient

func NewGreenClient(accessKeyId, accessKeySecret, endpoint string) (*GreenClient, error)

NewGreenClient creates a new instance of GreenClient. It takes the accessKeyId, accessKeySecret, and endpoint as parameters. It returns a pointer to the created GreenClient instance and an error if any occurred during the creation. The created client should be reused as much as possible to avoid repeatedly establishing connections and improve detection performance.

func (GreenClient) ImageModeration

func (c GreenClient) ImageModeration(req *ImageModerationRequest) (info *ImageModerationInfo, err error)

ImageModeration performs image moderation. It takes an ImageModerationRequest as a parameter and returns an error if the moderation operation fails.

func (GreenClient) ImageModerationAdvance added in v0.0.28

func (c GreenClient) ImageModerationAdvance(req *ImageModerationRequest) (list []*ImageModerationInfo, err error)

ImageModerationAdvance is a method on the GreenClient struct. It performs advanced image moderation by checking the image against a set of predefined labels. The method takes an ImageModerationRequest as a parameter, which includes the image URL or OSS details and the labels to check against. The method returns a list of ImageModerationInfo instances, each representing a label that the image was found to match with a confidence score higher than the predefined score. The method also returns an error if the image moderation operation fails. The method uses the Alibaba Cloud's Green service for image moderation.

type ImageModerationInfo added in v0.0.25

type ImageModerationInfo struct {
	Label      string
	Confidence float32
}

ImageModerationRequest is a struct that holds the information needed for image moderation.

type ImageModerationRequest

type ImageModerationRequest struct {
	// The URL of the image to be checked, which must be publicly accessible.
	ImageUrl *string
	// To use OSS authorization for detection, ossBucketName, ossObjectName, and ossRegionId must be passed in at the same time.
	// The name of the authorized OSS space, for example: bucket001
	OssBucketName *string
	// The file name of the authorized OSS space, for example: image/001.jpg
	OssObjectName *string
	// The region where the OSS Bucket is located, such as oss-cn-hangzhou.
	OssRegionID *string
	// Risk labels, where the key is the value of the risk label and the value is the corresponding score, ranging from 0-100. The higher the score, the higher the risk level.
	// https://help.aliyun.com/document_detail/467829.html?spm=a2c4g.467828.0.0.2fd42592WnfIdf
	Labels map[string]float32
	// 检测规则,可选值:baselineCheck(基础版检测)
	Service *string
}

ImageModerationRequest is a struct that holds the information needed for image moderation.

type PolicyToken added in v0.0.25

type PolicyToken struct {
	AccessKeyId string `json:"accessid"`
	Host        string `json:"host"`
	Expire      int64  `json:"expire"`
	Signature   string `json:"signature"`
	Policy      string `json:"policy"`
	Directory   string `json:"dir"`
	Callback    string `json:"callback"`
}

type SegmentationClient added in v0.0.27

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

func NewSegmentationClient added in v0.0.27

func NewSegmentationClient(accessKeyId, accessKeySecret, endpoint string) (*SegmentationClient, error)

func (SegmentationClient) SegmentBody added in v0.0.27

SegmentBody 人体分割

func (SegmentationClient) SegmentCommodity added in v0.0.27

SegmentCommodity 商品分割

func (SegmentationClient) SegmentCommodityAdvance added in v0.0.28

func (SegmentationClient) SegmentCommonImage added in v0.0.27

SegmentCommonImage 通用分割

func (SegmentationClient) SegmentCommonImageAdvance added in v0.0.28

SegmentCommonImage 通用分割

func (SegmentationClient) SegmentHDBody added in v0.0.27

SegmentHDBody 高清人体分割

func (SegmentationClient) SegmentHDCommonImage added in v0.0.27

SegmentHDCommonImage 通用高清分割

type SignUrlRequest

type SignUrlRequest struct {
	ObjectKey    string         // The object key
	Method       oss.HTTPMethod // The HTTP method
	ExpiredInSec int64          // The expiration time in seconds
	CdnDomain    *string        // The CDN domain
	Options      []oss.Option   // The options
}

SignUrlRequest is a struct that holds the information needed to generate a signed URL.

Jump to

Keyboard shortcuts

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