/
apiOperation.go
199 lines (186 loc) · 10.4 KB
/
apiOperation.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
// nolint: lll
package apimanagement
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages an API Operation within an API Management Service.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/api_management_api_operation.html.markdown.
type ApiOperation struct {
pulumi.CustomResourceState
// The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringOutput `pulumi:"apiManagementName"`
// The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
ApiName pulumi.StringOutput `pulumi:"apiName"`
// A description for this API Operation, which may include HTML formatting tags.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The Display Name for this API Management Operation.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
Method pulumi.StringOutput `pulumi:"method"`
// A unique identifier for this API Operation. Changing this forces a new resource to be created.
OperationId pulumi.StringOutput `pulumi:"operationId"`
// A `request` block as defined below.
Request ApiOperationRequestOutput `pulumi:"request"`
// The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// One or more `response` blocks as defined below.
Responses ApiOperationResponseArrayOutput `pulumi:"responses"`
// One or more `templateParameter` blocks as defined below.
TemplateParameters ApiOperationTemplateParameterArrayOutput `pulumi:"templateParameters"`
// The relative URL Template identifying the target resource for this operation, which may include parameters.
UrlTemplate pulumi.StringOutput `pulumi:"urlTemplate"`
}
// NewApiOperation registers a new resource with the given unique name, arguments, and options.
func NewApiOperation(ctx *pulumi.Context,
name string, args *ApiOperationArgs, opts ...pulumi.ResourceOption) (*ApiOperation, error) {
if args == nil || args.ApiManagementName == nil {
return nil, errors.New("missing required argument 'ApiManagementName'")
}
if args == nil || args.ApiName == nil {
return nil, errors.New("missing required argument 'ApiName'")
}
if args == nil || args.DisplayName == nil {
return nil, errors.New("missing required argument 'DisplayName'")
}
if args == nil || args.Method == nil {
return nil, errors.New("missing required argument 'Method'")
}
if args == nil || args.OperationId == nil {
return nil, errors.New("missing required argument 'OperationId'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil || args.UrlTemplate == nil {
return nil, errors.New("missing required argument 'UrlTemplate'")
}
if args == nil {
args = &ApiOperationArgs{}
}
var resource ApiOperation
err := ctx.RegisterResource("azure:apimanagement/apiOperation:ApiOperation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApiOperation gets an existing ApiOperation resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetApiOperation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApiOperationState, opts ...pulumi.ResourceOption) (*ApiOperation, error) {
var resource ApiOperation
err := ctx.ReadResource("azure:apimanagement/apiOperation:ApiOperation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ApiOperation resources.
type apiOperationState struct {
// The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ApiManagementName *string `pulumi:"apiManagementName"`
// The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
ApiName *string `pulumi:"apiName"`
// A description for this API Operation, which may include HTML formatting tags.
Description *string `pulumi:"description"`
// The Display Name for this API Management Operation.
DisplayName *string `pulumi:"displayName"`
// The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
Method *string `pulumi:"method"`
// A unique identifier for this API Operation. Changing this forces a new resource to be created.
OperationId *string `pulumi:"operationId"`
// A `request` block as defined below.
Request *ApiOperationRequest `pulumi:"request"`
// The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// One or more `response` blocks as defined below.
Responses []ApiOperationResponse `pulumi:"responses"`
// One or more `templateParameter` blocks as defined below.
TemplateParameters []ApiOperationTemplateParameter `pulumi:"templateParameters"`
// The relative URL Template identifying the target resource for this operation, which may include parameters.
UrlTemplate *string `pulumi:"urlTemplate"`
}
type ApiOperationState struct {
// The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringPtrInput
// The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
ApiName pulumi.StringPtrInput
// A description for this API Operation, which may include HTML formatting tags.
Description pulumi.StringPtrInput
// The Display Name for this API Management Operation.
DisplayName pulumi.StringPtrInput
// The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
Method pulumi.StringPtrInput
// A unique identifier for this API Operation. Changing this forces a new resource to be created.
OperationId pulumi.StringPtrInput
// A `request` block as defined below.
Request ApiOperationRequestPtrInput
// The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// One or more `response` blocks as defined below.
Responses ApiOperationResponseArrayInput
// One or more `templateParameter` blocks as defined below.
TemplateParameters ApiOperationTemplateParameterArrayInput
// The relative URL Template identifying the target resource for this operation, which may include parameters.
UrlTemplate pulumi.StringPtrInput
}
func (ApiOperationState) ElementType() reflect.Type {
return reflect.TypeOf((*apiOperationState)(nil)).Elem()
}
type apiOperationArgs struct {
// The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ApiManagementName string `pulumi:"apiManagementName"`
// The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
ApiName string `pulumi:"apiName"`
// A description for this API Operation, which may include HTML formatting tags.
Description *string `pulumi:"description"`
// The Display Name for this API Management Operation.
DisplayName string `pulumi:"displayName"`
// The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
Method string `pulumi:"method"`
// A unique identifier for this API Operation. Changing this forces a new resource to be created.
OperationId string `pulumi:"operationId"`
// A `request` block as defined below.
Request *ApiOperationRequest `pulumi:"request"`
// The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// One or more `response` blocks as defined below.
Responses []ApiOperationResponse `pulumi:"responses"`
// One or more `templateParameter` blocks as defined below.
TemplateParameters []ApiOperationTemplateParameter `pulumi:"templateParameters"`
// The relative URL Template identifying the target resource for this operation, which may include parameters.
UrlTemplate string `pulumi:"urlTemplate"`
}
// The set of arguments for constructing a ApiOperation resource.
type ApiOperationArgs struct {
// The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringInput
// The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
ApiName pulumi.StringInput
// A description for this API Operation, which may include HTML formatting tags.
Description pulumi.StringPtrInput
// The Display Name for this API Management Operation.
DisplayName pulumi.StringInput
// The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
Method pulumi.StringInput
// A unique identifier for this API Operation. Changing this forces a new resource to be created.
OperationId pulumi.StringInput
// A `request` block as defined below.
Request ApiOperationRequestPtrInput
// The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// One or more `response` blocks as defined below.
Responses ApiOperationResponseArrayInput
// One or more `templateParameter` blocks as defined below.
TemplateParameters ApiOperationTemplateParameterArrayInput
// The relative URL Template identifying the target resource for this operation, which may include parameters.
UrlTemplate pulumi.StringInput
}
func (ApiOperationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*apiOperationArgs)(nil)).Elem()
}