github.com/gophercloud/gophercloud@v1.11.0/openstack/workflow/v2/executions/doc.go (about)

     1  /*
     2  Package executions provides interaction with the execution API in the OpenStack Mistral service.
     3  
     4  An execution is a one-shot execution of a specific workflow. Each execution contains all information about workflow itself, about execution process, state, input and output data.
     5  
     6  An execution represents also the execution of a cron trigger. Each run of a cron trigger will generate an execution.
     7  
     8  # List executions
     9  
    10  To filter executions from a list request, you can use advanced filters with special FilterType to check for equality, non equality, values greater or lower, etc.
    11  Default Filter checks equality, but you can override it with provided filter type.
    12  
    13  	// List all executions from a given workflow list with a creation date upper than 2018-01-01 00:00:00
    14  	listOpts := executions.ListOpts{
    15  		WorkflowName: &executions.ListFilter{
    16  			Value: "Workflow1,Workflow2",
    17  			Filter: executions.FilterIN,
    18  		},
    19  		CreatedAt: &executions.ListDateFilter{
    20  			Value: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC),
    21  			Filter: executions.FilterGTE,
    22  		},
    23  	}
    24  
    25  	allPages, err := executions.List(mistralClient, listOpts).AllPages()
    26  	if err != nil {
    27  		panic(err)
    28  	}
    29  
    30  	allExecutions, err := executions.ExtractExecutions(allPages)
    31  	if err != nil {
    32  		panic(err)
    33  	}
    34  
    35  	for _, ex := range allExecutions {
    36  		fmt.Printf("%+v\n", ex)
    37  	}
    38  
    39  Create an execution
    40  
    41  	createOpts := &executions.CreateOpts{
    42  		WorkflowID:  "6656c143-a009-4bcb-9814-cc100a20bbfa",
    43  		Input: map[string]interface{}{
    44  			"msg": "Hello",
    45  		},
    46  		Description: "this is a description",
    47  	}
    48  
    49  	execution, err := executions.Create(mistralClient, createOpts).Extract()
    50  	if err != nil {
    51  		panic(err)
    52  	}
    53  
    54  Get an execution
    55  
    56  	execution, err := executions.Get(mistralClient, "50bb59f1-eb77-4017-a77f-6d575b002667").Extract()
    57  	if err != nil {
    58  		panic(err)
    59  	}
    60  	fmt.Printf(%+v\n", execution)
    61  
    62  Delete an execution
    63  
    64  	res := executions.Delete(mistralClient, "50bb59f1-eb77-4017-a77f-6d575b002667")
    65  	if res.Err != nil {
    66  		panic(res.Err)
    67  	}
    68  */
    69  package executions