首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pulumi意外地对部分共享访问签名(SAS)进行了urlencode

Pulumi意外地对部分共享访问签名(SAS)进行了urlencode
EN

Stack Overflow用户
提问于 2021-03-16 18:51:44
回答 1查看 36关注 0票数 0

我们使用下面的golang代码从Azure获取共享访问签名。它可以工作,但打印的sas有一些字段,“日期字段”,不正确的urlencoded。

代码语言:javascript
复制
...

conStr := ConvertPulumiStringToString(account.PrimaryConnectionString)
httpsOnly := true
now := time.Now()

sas, err := storage.GetAccountBlobContainerSAS(ctx, &storage.GetAccountBlobContainerSASArgs{
        ConnectionString:   <-conStr,
        ContainerName:      "container",
        Expiry:             now.AddDate(10, 0, 0).Format(time.RFC3339),
        HttpsOnly:          &httpsOnly,
        Permissions: storage.GetAccountBlobContainerSASPermissions{
            Add:    false,
            Create: false,
            Delete: false,
            List:   true,
            Read:   true,
            Write:  false,
        },
        Start: now.Format(time.RFC3339),
    })
    println(sas.Sas)

我们得到这个st=2021-03-16T10%3A58%3A24%2B01%3A00

我们预期此格式为st=2021-03-16T10:16:30Z

我试着查看了pulumi文档,但它非常有限。

任何帮助都是非常感谢的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-17 14:37:41

问题是,当使用RFC3339时,时区需要是UTC才能与Azure和pulumi一起工作。

代码语言:javascript
复制
conStr := ConvertPulumiStringToString(account.PrimaryConnectionString)
httpsOnly := true
now := time.Now().UTC()

sas, err := storage.GetAccountBlobContainerSAS(ctx, &storage.GetAccountBlobContainerSASArgs{
        ConnectionString:   <-conStr,
        ContainerName:      "container",
        Expiry:             now.AddDate(10, 0, 0).Format(time.RFC3339),
        HttpsOnly:          &httpsOnly,
        Permissions: storage.GetAccountBlobContainerSASPermissions{
            Add:    false,
            Create: false,
            Delete: false,
            List:   true,
            Read:   true,
            Write:  false,
        },
        Start: now.Format(time.RFC3339),
    })
    println(sas.Sas)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66653738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档