小编Pur*_*uru的帖子

如何为 AWS 中的成本和使用数据启用每小时粒度?

我正在尝试调用 AWS 的 get-cost-and-usage api 来生成每小时报告。但是,我在启用仅选择加入功能时遇到错误。

aws ce get-cost-and-usage --time-period '{"Start": "2020-06-10T00:00:00Z", "End": "2020-06-15T00:00:00Z"}' --granularity 'HOURLY' --metrics "AmortizedCost" "BlendedCost" "NetAmortizedCost" "NetUnblendedCost" "NormalizedUsageAmount" "UnblendedCost" "UsageQuantity" --group-by Type=DIMENSION,Key=SERVICE
Run Code Online (Sandbox Code Playgroud)

错误信息:

调用 GetCostAndUsage 操作时发生错误 (AccessDeniedException):每小时数据粒度是一项仅可选择加入的功能。您可以从付款人帐户的成本管理器设置页面启用此功能。

我没有看到任何启用此功能的设置页面。有没有办法通过控制台或 cli 启用此功能?

amazon-web-services aws-cli cost-management boto3

4
推荐指数
1
解决办法
2450
查看次数

访问共享扩展中的网页属性

当用户在iOS上使用javascript文件打开Share扩展时,我想访问网页属性(标题,元描述,URL,默认图像等).我正在使用以下代码的javascript(https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW12):

    var MyExtensionJavaScriptClass = function() {};

MyExtensionJavaScriptClass.prototype = {
    run: function(arguments) {
    // Pass the baseURI of the webpage to the extension.
        arguments.completionFunction({"url": document.baseURI});
        arguments.completionFunction({"host": getHost()});
        arguments.completionFunction({"title": document.title});
        arguments.completionFunction({"description": getDescription()});
        arguments.completionFunction({"image": getImage()});
    },
    getHost: function() {
        var l = document.createElement("a");
        l.href = href;
        return l.hostname;
    },
    getDescription: function() {
        var metas = document.getElementsByTagName('meta'); 

       for (i=0; i<metas.length; i++) { 
          if (metas[i].getAttribute("property") == "description") { 
             return metas[i].getAttribute("content"); 
          } 
       } 
        return "";
    },
    getImage: function() {
        // Need to find this …
Run Code Online (Sandbox Code Playgroud)

javascript uiviewcontroller ios share-extension

3
推荐指数
1
解决办法
1371
查看次数

gcloud 函数部署 go 运行时错误“未定义:unsafe.Slice;错误 ID:2f5e35a0”

在部署到谷歌云功能时,我收到此错误:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: # projectname/vendor/golang.org/x/sys/unix
src/projectname/vendor/golang.org/x/sys/unix/syscall.go:83:16: undefined: unsafe.Slice
src/projectname/vendor/golang.org/x/sys/unix/syscall_linux.go:2255:9: undefined: unsafe.Slice
src/projectname/vendor/golang.org/x/sys/unix/syscall_unix.go:118:7: undefined: unsafe.Slice
src/projectname/vendor/golang.org/x/sys/unix/sysvshm_unix.go:33:7: undefined: unsafe.Slice; Error ID: 2f5e35a0
Run Code Online (Sandbox Code Playgroud)

这是我的命令:

gcloud functions deploy servicename --region=us-central1 --entry-point=gofunctionname --runtime=go116 --source=.
Run Code Online (Sandbox Code Playgroud)

我正在使用供应商来打包我的依赖项。好久没更新这个功能了。我第一次注意到这个错误。

任何帮助将非常感激。

go slice gcloud google-cloud-functions google-cloud-build

3
推荐指数
1
解决办法
1万
查看次数