/
getResourceAction.go
153 lines (131 loc) · 7.01 KB
/
getResourceAction.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package azapi
import (
"context"
"reflect"
"github.com/dirien/pulumi-azapi/sdk/go/azapi/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This resource can perform resource action which gets information from an existing resource.
// It's recommended to use `ResourceAction` data source to perform readonly action, please use `ResourceAction` resource,
// if user wants to perform actions which change a resource's state.
//
// ## Example Usage
//
// Here's an example to use the `ResourceAction` data source to get a provider's permissions.
//
// Here's an example to use the `ResourceAction` data source to perform a provider action.
func LookupResourceAction(ctx *pulumi.Context, args *LookupResourceActionArgs, opts ...pulumi.InvokeOption) (*LookupResourceActionResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupResourceActionResult
err := ctx.Invoke("azapi:index/getResourceAction:getResourceAction", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getResourceAction.
type LookupResourceActionArgs struct {
// The name of the resource action. It's also possible to make Http requests towards the resource ID if leave this field empty.
Action *string `pulumi:"action"`
// A JSON object that contains the request body.
Body *string `pulumi:"body"`
// Specifies the Http method of the azure resource action. Allowed values are `POST` and `GET`. Defaults to `POST`.
Method *string `pulumi:"method"`
// The ID of an existing azure source.
ResourceId *string `pulumi:"resourceId"`
// A list of path that needs to be exported from response body.
// Setting it to `["*"]` will export the full response body.
// Here's an example. If it sets to `["keys"]`, it will set the following json to computed property `output`.
ResponseExportValues []string `pulumi:"responseExportValues"`
// It is in a format like `<resource-type>@<api-version>`. `<resource-type>` is the Azure resource type, for example, `Microsoft.Storage/storageAccounts`.
// `<api-version>` is version of the API used to manage this azure resource.
Type string `pulumi:"type"`
}
// A collection of values returned by getResourceAction.
type LookupResourceActionResult struct {
Action *string `pulumi:"action"`
Body *string `pulumi:"body"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Method *string `pulumi:"method"`
// The output json containing the properties specified in `responseExportValues`. Here are some examples to decode json and extract the value.
Output string `pulumi:"output"`
ResourceId *string `pulumi:"resourceId"`
ResponseExportValues []string `pulumi:"responseExportValues"`
Type string `pulumi:"type"`
}
func LookupResourceActionOutput(ctx *pulumi.Context, args LookupResourceActionOutputArgs, opts ...pulumi.InvokeOption) LookupResourceActionResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupResourceActionResult, error) {
args := v.(LookupResourceActionArgs)
r, err := LookupResourceAction(ctx, &args, opts...)
var s LookupResourceActionResult
if r != nil {
s = *r
}
return s, err
}).(LookupResourceActionResultOutput)
}
// A collection of arguments for invoking getResourceAction.
type LookupResourceActionOutputArgs struct {
// The name of the resource action. It's also possible to make Http requests towards the resource ID if leave this field empty.
Action pulumi.StringPtrInput `pulumi:"action"`
// A JSON object that contains the request body.
Body pulumi.StringPtrInput `pulumi:"body"`
// Specifies the Http method of the azure resource action. Allowed values are `POST` and `GET`. Defaults to `POST`.
Method pulumi.StringPtrInput `pulumi:"method"`
// The ID of an existing azure source.
ResourceId pulumi.StringPtrInput `pulumi:"resourceId"`
// A list of path that needs to be exported from response body.
// Setting it to `["*"]` will export the full response body.
// Here's an example. If it sets to `["keys"]`, it will set the following json to computed property `output`.
ResponseExportValues pulumi.StringArrayInput `pulumi:"responseExportValues"`
// It is in a format like `<resource-type>@<api-version>`. `<resource-type>` is the Azure resource type, for example, `Microsoft.Storage/storageAccounts`.
// `<api-version>` is version of the API used to manage this azure resource.
Type pulumi.StringInput `pulumi:"type"`
}
func (LookupResourceActionOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupResourceActionArgs)(nil)).Elem()
}
// A collection of values returned by getResourceAction.
type LookupResourceActionResultOutput struct{ *pulumi.OutputState }
func (LookupResourceActionResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupResourceActionResult)(nil)).Elem()
}
func (o LookupResourceActionResultOutput) ToLookupResourceActionResultOutput() LookupResourceActionResultOutput {
return o
}
func (o LookupResourceActionResultOutput) ToLookupResourceActionResultOutputWithContext(ctx context.Context) LookupResourceActionResultOutput {
return o
}
func (o LookupResourceActionResultOutput) Action() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupResourceActionResult) *string { return v.Action }).(pulumi.StringPtrOutput)
}
func (o LookupResourceActionResultOutput) Body() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupResourceActionResult) *string { return v.Body }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupResourceActionResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupResourceActionResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupResourceActionResultOutput) Method() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupResourceActionResult) *string { return v.Method }).(pulumi.StringPtrOutput)
}
// The output json containing the properties specified in `responseExportValues`. Here are some examples to decode json and extract the value.
func (o LookupResourceActionResultOutput) Output() pulumi.StringOutput {
return o.ApplyT(func(v LookupResourceActionResult) string { return v.Output }).(pulumi.StringOutput)
}
func (o LookupResourceActionResultOutput) ResourceId() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupResourceActionResult) *string { return v.ResourceId }).(pulumi.StringPtrOutput)
}
func (o LookupResourceActionResultOutput) ResponseExportValues() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupResourceActionResult) []string { return v.ResponseExportValues }).(pulumi.StringArrayOutput)
}
func (o LookupResourceActionResultOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v LookupResourceActionResult) string { return v.Type }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupResourceActionResultOutput{})
}