mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Conver to regular Go vendor + dep tool
This commit is contained in:
+2500
File diff suppressed because it is too large
Load Diff
+108
@@ -0,0 +1,108 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
// Package efsiface provides an interface to enable mocking the Amazon Elastic File System service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package efsiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/efs"
|
||||
)
|
||||
|
||||
// EFSAPI provides an interface to enable mocking the
|
||||
// efs.EFS service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // Amazon Elastic File System.
|
||||
// func myFunc(svc efsiface.EFSAPI) bool {
|
||||
// // Make svc.CreateFileSystem request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := efs.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockEFSClient struct {
|
||||
// efsiface.EFSAPI
|
||||
// }
|
||||
// func (m *mockEFSClient) CreateFileSystem(input *efs.CreateFileSystemInput) (*efs.FileSystemDescription, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockEFSClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type EFSAPI interface {
|
||||
CreateFileSystem(*efs.CreateFileSystemInput) (*efs.FileSystemDescription, error)
|
||||
CreateFileSystemWithContext(aws.Context, *efs.CreateFileSystemInput, ...request.Option) (*efs.FileSystemDescription, error)
|
||||
CreateFileSystemRequest(*efs.CreateFileSystemInput) (*request.Request, *efs.FileSystemDescription)
|
||||
|
||||
CreateMountTarget(*efs.CreateMountTargetInput) (*efs.MountTargetDescription, error)
|
||||
CreateMountTargetWithContext(aws.Context, *efs.CreateMountTargetInput, ...request.Option) (*efs.MountTargetDescription, error)
|
||||
CreateMountTargetRequest(*efs.CreateMountTargetInput) (*request.Request, *efs.MountTargetDescription)
|
||||
|
||||
CreateTags(*efs.CreateTagsInput) (*efs.CreateTagsOutput, error)
|
||||
CreateTagsWithContext(aws.Context, *efs.CreateTagsInput, ...request.Option) (*efs.CreateTagsOutput, error)
|
||||
CreateTagsRequest(*efs.CreateTagsInput) (*request.Request, *efs.CreateTagsOutput)
|
||||
|
||||
DeleteFileSystem(*efs.DeleteFileSystemInput) (*efs.DeleteFileSystemOutput, error)
|
||||
DeleteFileSystemWithContext(aws.Context, *efs.DeleteFileSystemInput, ...request.Option) (*efs.DeleteFileSystemOutput, error)
|
||||
DeleteFileSystemRequest(*efs.DeleteFileSystemInput) (*request.Request, *efs.DeleteFileSystemOutput)
|
||||
|
||||
DeleteMountTarget(*efs.DeleteMountTargetInput) (*efs.DeleteMountTargetOutput, error)
|
||||
DeleteMountTargetWithContext(aws.Context, *efs.DeleteMountTargetInput, ...request.Option) (*efs.DeleteMountTargetOutput, error)
|
||||
DeleteMountTargetRequest(*efs.DeleteMountTargetInput) (*request.Request, *efs.DeleteMountTargetOutput)
|
||||
|
||||
DeleteTags(*efs.DeleteTagsInput) (*efs.DeleteTagsOutput, error)
|
||||
DeleteTagsWithContext(aws.Context, *efs.DeleteTagsInput, ...request.Option) (*efs.DeleteTagsOutput, error)
|
||||
DeleteTagsRequest(*efs.DeleteTagsInput) (*request.Request, *efs.DeleteTagsOutput)
|
||||
|
||||
DescribeFileSystems(*efs.DescribeFileSystemsInput) (*efs.DescribeFileSystemsOutput, error)
|
||||
DescribeFileSystemsWithContext(aws.Context, *efs.DescribeFileSystemsInput, ...request.Option) (*efs.DescribeFileSystemsOutput, error)
|
||||
DescribeFileSystemsRequest(*efs.DescribeFileSystemsInput) (*request.Request, *efs.DescribeFileSystemsOutput)
|
||||
|
||||
DescribeMountTargetSecurityGroups(*efs.DescribeMountTargetSecurityGroupsInput) (*efs.DescribeMountTargetSecurityGroupsOutput, error)
|
||||
DescribeMountTargetSecurityGroupsWithContext(aws.Context, *efs.DescribeMountTargetSecurityGroupsInput, ...request.Option) (*efs.DescribeMountTargetSecurityGroupsOutput, error)
|
||||
DescribeMountTargetSecurityGroupsRequest(*efs.DescribeMountTargetSecurityGroupsInput) (*request.Request, *efs.DescribeMountTargetSecurityGroupsOutput)
|
||||
|
||||
DescribeMountTargets(*efs.DescribeMountTargetsInput) (*efs.DescribeMountTargetsOutput, error)
|
||||
DescribeMountTargetsWithContext(aws.Context, *efs.DescribeMountTargetsInput, ...request.Option) (*efs.DescribeMountTargetsOutput, error)
|
||||
DescribeMountTargetsRequest(*efs.DescribeMountTargetsInput) (*request.Request, *efs.DescribeMountTargetsOutput)
|
||||
|
||||
DescribeTags(*efs.DescribeTagsInput) (*efs.DescribeTagsOutput, error)
|
||||
DescribeTagsWithContext(aws.Context, *efs.DescribeTagsInput, ...request.Option) (*efs.DescribeTagsOutput, error)
|
||||
DescribeTagsRequest(*efs.DescribeTagsInput) (*request.Request, *efs.DescribeTagsOutput)
|
||||
|
||||
ModifyMountTargetSecurityGroups(*efs.ModifyMountTargetSecurityGroupsInput) (*efs.ModifyMountTargetSecurityGroupsOutput, error)
|
||||
ModifyMountTargetSecurityGroupsWithContext(aws.Context, *efs.ModifyMountTargetSecurityGroupsInput, ...request.Option) (*efs.ModifyMountTargetSecurityGroupsOutput, error)
|
||||
ModifyMountTargetSecurityGroupsRequest(*efs.ModifyMountTargetSecurityGroupsInput) (*request.Request, *efs.ModifyMountTargetSecurityGroupsOutput)
|
||||
}
|
||||
|
||||
var _ EFSAPI = (*efs.EFS)(nil)
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package efs
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeBadRequest for service response error code
|
||||
// "BadRequest".
|
||||
//
|
||||
// Returned if the request is malformed or contains an error such as an invalid
|
||||
// parameter value or a missing required parameter.
|
||||
ErrCodeBadRequest = "BadRequest"
|
||||
|
||||
// ErrCodeDependencyTimeout for service response error code
|
||||
// "DependencyTimeout".
|
||||
//
|
||||
// The service timed out trying to fulfill the request, and the client should
|
||||
// try the call again.
|
||||
ErrCodeDependencyTimeout = "DependencyTimeout"
|
||||
|
||||
// ErrCodeFileSystemAlreadyExists for service response error code
|
||||
// "FileSystemAlreadyExists".
|
||||
//
|
||||
// Returned if the file system you are trying to create already exists, with
|
||||
// the creation token you provided.
|
||||
ErrCodeFileSystemAlreadyExists = "FileSystemAlreadyExists"
|
||||
|
||||
// ErrCodeFileSystemInUse for service response error code
|
||||
// "FileSystemInUse".
|
||||
//
|
||||
// Returned if a file system has mount targets.
|
||||
ErrCodeFileSystemInUse = "FileSystemInUse"
|
||||
|
||||
// ErrCodeFileSystemLimitExceeded for service response error code
|
||||
// "FileSystemLimitExceeded".
|
||||
//
|
||||
// Returned if the AWS account has already created maximum number of file systems
|
||||
// allowed per account.
|
||||
ErrCodeFileSystemLimitExceeded = "FileSystemLimitExceeded"
|
||||
|
||||
// ErrCodeFileSystemNotFound for service response error code
|
||||
// "FileSystemNotFound".
|
||||
//
|
||||
// Returned if the specified FileSystemId does not exist in the requester's
|
||||
// AWS account.
|
||||
ErrCodeFileSystemNotFound = "FileSystemNotFound"
|
||||
|
||||
// ErrCodeIncorrectFileSystemLifeCycleState for service response error code
|
||||
// "IncorrectFileSystemLifeCycleState".
|
||||
//
|
||||
// Returned if the file system's life cycle state is not "created".
|
||||
ErrCodeIncorrectFileSystemLifeCycleState = "IncorrectFileSystemLifeCycleState"
|
||||
|
||||
// ErrCodeIncorrectMountTargetState for service response error code
|
||||
// "IncorrectMountTargetState".
|
||||
//
|
||||
// Returned if the mount target is not in the correct state for the operation.
|
||||
ErrCodeIncorrectMountTargetState = "IncorrectMountTargetState"
|
||||
|
||||
// ErrCodeInternalServerError for service response error code
|
||||
// "InternalServerError".
|
||||
//
|
||||
// Returned if an error occurred on the server side.
|
||||
ErrCodeInternalServerError = "InternalServerError"
|
||||
|
||||
// ErrCodeIpAddressInUse for service response error code
|
||||
// "IpAddressInUse".
|
||||
//
|
||||
// Returned if the request specified an IpAddress that is already in use in
|
||||
// the subnet.
|
||||
ErrCodeIpAddressInUse = "IpAddressInUse"
|
||||
|
||||
// ErrCodeMountTargetConflict for service response error code
|
||||
// "MountTargetConflict".
|
||||
//
|
||||
// Returned if the mount target would violate one of the specified restrictions
|
||||
// based on the file system's existing mount targets.
|
||||
ErrCodeMountTargetConflict = "MountTargetConflict"
|
||||
|
||||
// ErrCodeMountTargetNotFound for service response error code
|
||||
// "MountTargetNotFound".
|
||||
//
|
||||
// Returned if there is no mount target with the specified ID found in the caller's
|
||||
// account.
|
||||
ErrCodeMountTargetNotFound = "MountTargetNotFound"
|
||||
|
||||
// ErrCodeNetworkInterfaceLimitExceeded for service response error code
|
||||
// "NetworkInterfaceLimitExceeded".
|
||||
//
|
||||
// The calling account has reached the ENI limit for the specific AWS region.
|
||||
// Client should try to delete some ENIs or get its account limit raised. For
|
||||
// more information, see Amazon VPC Limits (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html)
|
||||
// in the Amazon Virtual Private Cloud User Guide (see the Network interfaces
|
||||
// per VPC entry in the table).
|
||||
ErrCodeNetworkInterfaceLimitExceeded = "NetworkInterfaceLimitExceeded"
|
||||
|
||||
// ErrCodeNoFreeAddressesInSubnet for service response error code
|
||||
// "NoFreeAddressesInSubnet".
|
||||
//
|
||||
// Returned if IpAddress was not specified in the request and there are no free
|
||||
// IP addresses in the subnet.
|
||||
ErrCodeNoFreeAddressesInSubnet = "NoFreeAddressesInSubnet"
|
||||
|
||||
// ErrCodeSecurityGroupLimitExceeded for service response error code
|
||||
// "SecurityGroupLimitExceeded".
|
||||
//
|
||||
// Returned if the size of SecurityGroups specified in the request is greater
|
||||
// than five.
|
||||
ErrCodeSecurityGroupLimitExceeded = "SecurityGroupLimitExceeded"
|
||||
|
||||
// ErrCodeSecurityGroupNotFound for service response error code
|
||||
// "SecurityGroupNotFound".
|
||||
//
|
||||
// Returned if one of the specified security groups does not exist in the subnet's
|
||||
// VPC.
|
||||
ErrCodeSecurityGroupNotFound = "SecurityGroupNotFound"
|
||||
|
||||
// ErrCodeSubnetNotFound for service response error code
|
||||
// "SubnetNotFound".
|
||||
//
|
||||
// Returned if there is no subnet with ID SubnetId provided in the request.
|
||||
ErrCodeSubnetNotFound = "SubnetNotFound"
|
||||
|
||||
// ErrCodeUnsupportedAvailabilityZone for service response error code
|
||||
// "UnsupportedAvailabilityZone".
|
||||
ErrCodeUnsupportedAvailabilityZone = "UnsupportedAvailabilityZone"
|
||||
)
|
||||
+277
@@ -0,0 +1,277 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package efs_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/efs"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ bytes.Buffer
|
||||
|
||||
func ExampleEFS_CreateFileSystem() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_CreateMountTarget() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_CreateTags() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DeleteFileSystem() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DeleteMountTarget() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
params := &efs.DeleteMountTargetInput{
|
||||
MountTargetId: aws.String("MountTargetId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteMountTarget(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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DeleteTags() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
params := &efs.DeleteTagsInput{
|
||||
FileSystemId: aws.String("FileSystemId"), // Required
|
||||
TagKeys: []*string{ // Required
|
||||
aws.String("TagKey"), // Required
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.DeleteTags(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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DescribeFileSystems() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DescribeMountTargetSecurityGroups() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DescribeMountTargets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
params := &efs.DescribeMountTargetsInput{
|
||||
FileSystemId: aws.String("FileSystemId"),
|
||||
Marker: aws.String("Marker"),
|
||||
MaxItems: aws.Int64(1),
|
||||
MountTargetId: aws.String("MountTargetId"),
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_DescribeTags() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func ExampleEFS_ModifyMountTargetSecurityGroups() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := efs.New(sess)
|
||||
|
||||
params := &efs.ModifyMountTargetSecurityGroupsInput{
|
||||
MountTargetId: aws.String("MountTargetId"), // Required
|
||||
SecurityGroups: []*string{
|
||||
aws.String("SecurityGroup"), // Required
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.ModifyMountTargetSecurityGroups(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)
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package efs
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restjson"
|
||||
)
|
||||
|
||||
// Amazon Elastic File System (Amazon EFS) provides simple, scalable file storage
|
||||
// for use with Amazon EC2 instances in the AWS Cloud. With Amazon EFS, storage
|
||||
// capacity is elastic, growing and shrinking automatically as you add and remove
|
||||
// files, so your applications have the storage they need, when they need it.
|
||||
// For more information, see the User Guide (http://docs.aws.amazon.com/efs/latest/ug/api-reference.html).
|
||||
// The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01
|
||||
type EFS struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "elasticfilesystem" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the EFS client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a EFS client from just a session.
|
||||
// svc := efs.New(mySession)
|
||||
//
|
||||
// // Create a EFS client with additional configuration
|
||||
// svc := efs.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EFS {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *EFS {
|
||||
svc := &EFS{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2015-02-01",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a EFS operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *EFS) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
Reference in New Issue
Block a user