本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/efs.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleEFS_CreateFileSystem
func ExampleEFS_CreateFileSystem() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := efs.New(sess)
params := &efs.CreateFileSystemInput{
CreationToken: aws.String("CreationToken"), // Required
PerformanceMode: aws.String("PerformanceMode"),
}
resp, err := svc.CreateFileSystem(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例2: ExampleEFS_CreateTags
func ExampleEFS_CreateTags() {
svc := efs.New(nil)
params := &efs.CreateTagsInput{
FileSystemId: aws.String("FileSystemId"), // Required
Tags: []*efs.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"), // Required
},
// More values...
},
}
resp, err := svc.CreateTags(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例3: ExampleEFS_DescribeTags
func ExampleEFS_DescribeTags() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := efs.New(sess)
params := &efs.DescribeTagsInput{
FileSystemId: aws.String("FileSystemId"), // Required
Marker: aws.String("Marker"),
MaxItems: aws.Int64(1),
}
resp, err := svc.DescribeTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例4: ExampleEFS_CreateMountTarget
func ExampleEFS_CreateMountTarget() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := efs.New(sess)
params := &efs.CreateMountTargetInput{
FileSystemId: aws.String("FileSystemId"), // Required
SubnetId: aws.String("SubnetId"), // Required
IpAddress: aws.String("IpAddress"),
SecurityGroups: []*string{
aws.String("SecurityGroup"), // Required
// More values...
},
}
resp, err := svc.CreateMountTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例5: ExampleEFS_DescribeTags
func ExampleEFS_DescribeTags() {
svc := efs.New(nil)
params := &efs.DescribeTagsInput{
FileSystemId: aws.String("FileSystemId"), // Required
Marker: aws.String("Marker"),
MaxItems: aws.Int64(1),
}
resp, err := svc.DescribeTags(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例6: ExampleEFS_CreateMountTarget
func ExampleEFS_CreateMountTarget() {
svc := efs.New(nil)
params := &efs.CreateMountTargetInput{
FileSystemId: aws.String("FileSystemId"), // Required
SubnetId: aws.String("SubnetId"), // Required
IpAddress: aws.String("IpAddress"),
SecurityGroups: []*string{
aws.String("SecurityGroup"), // Required
// More values...
},
}
resp, err := svc.CreateMountTarget(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例7: ExampleEFS_CreateTags
func ExampleEFS_CreateTags() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := efs.New(sess)
params := &efs.CreateTagsInput{
FileSystemId: aws.String("FileSystemId"), // Required
Tags: []*efs.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"), // Required
},
// More values...
},
}
resp, err := svc.CreateTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例8: init
func init() {
Before("@efs", func() {
// FIXME remove custom region
World["client"] = efs.New(smoke.Session,
aws.NewConfig().WithRegion("us-west-2"))
})
}
示例9: ExampleEFS_DescribeMountTargetSecurityGroups
func ExampleEFS_DescribeMountTargetSecurityGroups() {
svc := efs.New(nil)
params := &efs.DescribeMountTargetSecurityGroupsInput{
MountTargetID: aws.String("MountTargetId"), // Required
}
resp, err := svc.DescribeMountTargetSecurityGroups(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
示例10: Mount
func (d DriverEFS) Mount(r dkvolume.Request) dkvolume.Response {
p := filepath.Join(d.Root, r.Name)
// Check if the directory already exists.
nfs, err := mount.Mounted(p)
if err != nil {
return dkvolume.Response{Err: err.Error()}
}
if Exists(p) && nfs {
log.Printf("Existing: %s", r.Name)
return dkvolume.Response{Mountpoint: p}
}
e := efs.New(&aws.Config{Region: aws.String(d.Region)})
m, err := GetEFS(e, d.Subnet, r.Name)
if err != nil {
return dkvolume.Response{Err: err.Error()}
}
if err := os.MkdirAll(p, 0755); err != nil {
return dkvolume.Response{Err: err.Error()}
}
// Mount the EFS volume to the local filesystem.
// @todo, Swap this out with an NFS client library.
if err := Exec("mount", "-t", "nfs4", m+":/", p); err != nil {
return dkvolume.Response{Err: err.Error()}
}
log.Printf("Mounting: %s", r.Name)
return dkvolume.Response{Mountpoint: p}
}
示例11: ExampleEFS_DescribeMountTargetSecurityGroups
func ExampleEFS_DescribeMountTargetSecurityGroups() {
svc := efs.New(nil)
params := &efs.DescribeMountTargetSecurityGroupsInput{
MountTargetId: aws.String("MountTargetId"), // Required
}
resp, err := svc.DescribeMountTargetSecurityGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例12: ExampleEFS_CreateFileSystem
func ExampleEFS_CreateFileSystem() {
svc := efs.New(session.New())
params := &efs.CreateFileSystemInput{
CreationToken: aws.String("CreationToken"), // Required
}
resp, err := svc.CreateFileSystem(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例13: ExampleEFS_DeleteFileSystem
func ExampleEFS_DeleteFileSystem() {
svc := efs.New(nil)
params := &efs.DeleteFileSystemInput{
FileSystemId: aws.String("FileSystemId"), // Required
}
resp, err := svc.DeleteFileSystem(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例14: ExampleEFS_DescribeMountTargets
func ExampleEFS_DescribeMountTargets() {
svc := efs.New(nil)
params := &efs.DescribeMountTargetsInput{
FileSystemId: aws.String("FileSystemId"), // Required
Marker: aws.String("Marker"),
MaxItems: aws.Int64(1),
}
resp, err := svc.DescribeMountTargets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例15: ExampleEFS_DescribeFileSystems
func ExampleEFS_DescribeFileSystems() {
svc := efs.New(session.New())
params := &efs.DescribeFileSystemsInput{
CreationToken: aws.String("CreationToken"),
FileSystemId: aws.String("FileSystemId"),
Marker: aws.String("Marker"),
MaxItems: aws.Int64(1),
}
resp, err := svc.DescribeFileSystems(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}