本文整理匯總了Golang中github.com/gunosy/aws-sdk-go/service/swf.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleSWF_RequestCancelWorkflowExecution
func ExampleSWF_RequestCancelWorkflowExecution() {
svc := swf.New(nil)
params := &swf.RequestCancelWorkflowExecutionInput{
Domain: aws.String("DomainName"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
RunID: aws.String("RunIdOptional"),
}
resp, err := svc.RequestCancelWorkflowExecution(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))
}
示例2: ExampleSWF_RespondActivityTaskFailed
func ExampleSWF_RespondActivityTaskFailed() {
svc := swf.New(nil)
params := &swf.RespondActivityTaskFailedInput{
TaskToken: aws.String("TaskToken"), // Required
Details: aws.String("Data"),
Reason: aws.String("FailureReason"),
}
resp, err := svc.RespondActivityTaskFailed(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: ExampleSWF_PollForDecisionTask
func ExampleSWF_PollForDecisionTask() {
svc := swf.New(nil)
params := &swf.PollForDecisionTaskInput{
Domain: aws.String("DomainName"), // Required
TaskList: &swf.TaskList{ // Required
Name: aws.String("Name"), // Required
},
Identity: aws.String("Identity"),
MaximumPageSize: aws.Int64(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Bool(true),
}
resp, err := svc.PollForDecisionTask(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))
}
示例4: ExampleSWF_GetWorkflowExecutionHistory
func ExampleSWF_GetWorkflowExecutionHistory() {
svc := swf.New(nil)
params := &swf.GetWorkflowExecutionHistoryInput{
Domain: aws.String("DomainName"), // Required
Execution: &swf.WorkflowExecution{ // Required
RunID: aws.String("RunId"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
},
MaximumPageSize: aws.Int64(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Bool(true),
}
resp, err := svc.GetWorkflowExecutionHistory(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))
}
示例5: ExampleSWF_DescribeActivityType
func ExampleSWF_DescribeActivityType() {
svc := swf.New(nil)
params := &swf.DescribeActivityTypeInput{
ActivityType: &swf.ActivityType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
Domain: aws.String("DomainName"), // Required
}
resp, err := svc.DescribeActivityType(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: ExampleSWF_ListClosedWorkflowExecutions
func ExampleSWF_ListClosedWorkflowExecutions() {
svc := swf.New(nil)
params := &swf.ListClosedWorkflowExecutionsInput{
Domain: aws.String("DomainName"), // Required
CloseStatusFilter: &swf.CloseStatusFilter{
Status: aws.String("CloseStatus"), // Required
},
CloseTimeFilter: &swf.ExecutionTimeFilter{
OldestDate: aws.Time(time.Now()), // Required
LatestDate: aws.Time(time.Now()),
},
ExecutionFilter: &swf.WorkflowExecutionFilter{
WorkflowID: aws.String("WorkflowId"), // Required
},
MaximumPageSize: aws.Int64(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Bool(true),
StartTimeFilter: &swf.ExecutionTimeFilter{
OldestDate: aws.Time(time.Now()), // Required
LatestDate: aws.Time(time.Now()),
},
TagFilter: &swf.TagFilter{
Tag: aws.String("Tag"), // Required
},
TypeFilter: &swf.WorkflowTypeFilter{
Name: aws.String("Name"), // Required
Version: aws.String("VersionOptional"),
},
}
resp, err := svc.ListClosedWorkflowExecutions(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: ExampleSWF_StartWorkflowExecution
func ExampleSWF_StartWorkflowExecution() {
svc := swf.New(nil)
params := &swf.StartWorkflowExecutionInput{
Domain: aws.String("DomainName"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
WorkflowType: &swf.WorkflowType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
ChildPolicy: aws.String("ChildPolicy"),
ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
LambdaRole: aws.String("Arn"),
TagList: []*string{
aws.String("Tag"), // Required
// More values...
},
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
}
resp, err := svc.StartWorkflowExecution(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))
}
示例8: ExampleSWF_RegisterActivityType
func ExampleSWF_RegisterActivityType() {
svc := swf.New(nil)
params := &swf.RegisterActivityTypeInput{
Domain: aws.String("DomainName"), // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
DefaultTaskHeartbeatTimeout: aws.String("DurationInSecondsOptional"),
DefaultTaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
DefaultTaskPriority: aws.String("TaskPriority"),
DefaultTaskScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
DefaultTaskScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
DefaultTaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Description: aws.String("Description"),
}
resp, err := svc.RegisterActivityType(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))
}
示例9: init
func init() {
Before("@swf", func() {
World["client"] = swf.New(nil)
})
}
示例10: ExampleSWF_RespondDecisionTaskCompleted
func ExampleSWF_RespondDecisionTaskCompleted() {
svc := swf.New(nil)
params := &swf.RespondDecisionTaskCompletedInput{
TaskToken: aws.String("TaskToken"), // Required
Decisions: []*swf.Decision{
{ // Required
DecisionType: aws.String("DecisionType"), // Required
CancelTimerDecisionAttributes: &swf.CancelTimerDecisionAttributes{
TimerID: aws.String("TimerId"), // Required
},
CancelWorkflowExecutionDecisionAttributes: &swf.CancelWorkflowExecutionDecisionAttributes{
Details: aws.String("Data"),
},
CompleteWorkflowExecutionDecisionAttributes: &swf.CompleteWorkflowExecutionDecisionAttributes{
Result: aws.String("Data"),
},
ContinueAsNewWorkflowExecutionDecisionAttributes: &swf.ContinueAsNewWorkflowExecutionDecisionAttributes{
ChildPolicy: aws.String("ChildPolicy"),
ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
LambdaRole: aws.String("Arn"),
TagList: []*string{
aws.String("Tag"), // Required
// More values...
},
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
WorkflowTypeVersion: aws.String("Version"),
},
FailWorkflowExecutionDecisionAttributes: &swf.FailWorkflowExecutionDecisionAttributes{
Details: aws.String("Data"),
Reason: aws.String("FailureReason"),
},
RecordMarkerDecisionAttributes: &swf.RecordMarkerDecisionAttributes{
MarkerName: aws.String("MarkerName"), // Required
Details: aws.String("Data"),
},
RequestCancelActivityTaskDecisionAttributes: &swf.RequestCancelActivityTaskDecisionAttributes{
ActivityID: aws.String("ActivityId"), // Required
},
RequestCancelExternalWorkflowExecutionDecisionAttributes: &swf.RequestCancelExternalWorkflowExecutionDecisionAttributes{
WorkflowID: aws.String("WorkflowId"), // Required
Control: aws.String("Data"),
RunID: aws.String("RunIdOptional"),
},
ScheduleActivityTaskDecisionAttributes: &swf.ScheduleActivityTaskDecisionAttributes{
ActivityID: aws.String("ActivityId"), // Required
ActivityType: &swf.ActivityType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
Control: aws.String("Data"),
HeartbeatTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
ScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
ScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
StartToCloseTimeout: aws.String("DurationInSecondsOptional"),
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
},
ScheduleLambdaFunctionDecisionAttributes: &swf.ScheduleLambdaFunctionDecisionAttributes{
ID: aws.String("FunctionId"), // Required
Name: aws.String("FunctionName"), // Required
Input: aws.String("FunctionInput"),
StartToCloseTimeout: aws.String("DurationInSecondsOptional"),
},
SignalExternalWorkflowExecutionDecisionAttributes: &swf.SignalExternalWorkflowExecutionDecisionAttributes{
SignalName: aws.String("SignalName"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
Control: aws.String("Data"),
Input: aws.String("Data"),
RunID: aws.String("RunIdOptional"),
},
StartChildWorkflowExecutionDecisionAttributes: &swf.StartChildWorkflowExecutionDecisionAttributes{
WorkflowID: aws.String("WorkflowId"), // Required
WorkflowType: &swf.WorkflowType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
ChildPolicy: aws.String("ChildPolicy"),
Control: aws.String("Data"),
ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
LambdaRole: aws.String("Arn"),
TagList: []*string{
aws.String("Tag"), // Required
// More values...
},
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
},
//.........這裏部分代碼省略.........
示例11: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*swfiface.SWFAPI)(nil), swf.New(nil))
}