发布于 2017-05-16 18:12:47
API文档如下:
https://boto3.readthedocs.io/en/stable/index.html
动态生成可用资源。如果您只是尝试创建一个伪资源,您应该能够在错误消息中看到当前可用的顶级资源:
>>> boto3.resource('potato')
ResourceNotExistsError: The 'potato' resource does not exist.
The available resources are:
- cloudformation
- cloudwatch
- dynamodb
- ec2
- glacier
- iam
- opsworks
- s3
- sns
- sqs
>>> boto3.client('bogus')
UnknownServiceError: Unknown service: 'bogus'. Valid service names are: acm, apigateway, application-autoscaling, appstream, autoscaling, batch, budgets, clouddirectory, cloudformation, cloudfront, cloudhsm, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, codebuild, codecommit, codedeploy, codepipeline, codestar, cognito-identity, cognito-idp, cognito-sync, config, cur, datapipeline, devicefarm, directconnect, discovery, dms, ds, dynamodb, dynamodbstreams, ec2, ecr, ecs, efs, elasticache, elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, firehose, gamelift, glacier, health, iam, importexport, inspector, iot, iot-data, kinesis, kinesisanalytics, kms, lambda, lex-models, lex-runtime, lightsail, logs, machinelearning, marketplacecommerceanalytics, meteringmarketplace, mturk, opsworks, opsworkscm, organizations, pinpoint, polly, rds, redshift, rekognition, resourcegroupstaggingapi, route53, route53domains, s3, sdb, servicecatalog, ses, shield, sms, snowball, sns, sqs, ssm, stepfunctions, storagegateway, sts, support, swf, waf, waf-regional, workdocs, workspaces, xray实际上,您可以对客户端执行从json文件动态生成操作。例如,这里是亚马逊冰川的服务描述。
客户端还可以使用以下方法告诉您可用的子资源:
>>> glacier = boto3.resource('glacier')
>>> glacier.get_available_subresources()
['Account', 'Archive', 'Job', 'MultipartUpload', 'Notification', 'Vault']例如,实例化glacier.Archive()所需的参数是清楚地记录。文档非常好,但是从直接读取服务描述文件中也可以很容易地识别出相同的信息。
https://stackoverflow.com/questions/44008633
复制相似问题