This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
subscription.go
274 lines (250 loc) · 16.1 KB
/
subscription.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20170301
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Subscription details.
type Subscription struct {
pulumi.CustomResourceState
// Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
CreatedDate pulumi.StringOutput `pulumi:"createdDate"`
// The name of the subscription, or null if the subscription has no name.
DisplayName pulumi.StringPtrOutput `pulumi:"displayName"`
// Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
EndDate pulumi.StringPtrOutput `pulumi:"endDate"`
// Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
ExpirationDate pulumi.StringPtrOutput `pulumi:"expirationDate"`
// Resource name.
Name pulumi.StringOutput `pulumi:"name"`
// Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
NotificationDate pulumi.StringPtrOutput `pulumi:"notificationDate"`
// Subscription primary key.
PrimaryKey pulumi.StringOutput `pulumi:"primaryKey"`
// The product resource identifier of the subscribed product. The value is a valid relative URL in the format of /products/{productId} where {productId} is a product identifier.
ProductId pulumi.StringOutput `pulumi:"productId"`
// Subscription secondary key.
SecondaryKey pulumi.StringOutput `pulumi:"secondaryKey"`
// Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
StartDate pulumi.StringPtrOutput `pulumi:"startDate"`
// Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
State pulumi.StringOutput `pulumi:"state"`
// Optional subscription comment added by an administrator.
StateComment pulumi.StringPtrOutput `pulumi:"stateComment"`
// Resource type for API Management resource.
Type pulumi.StringOutput `pulumi:"type"`
// The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{uid} where {uid} is a user identifier.
UserId pulumi.StringOutput `pulumi:"userId"`
}
// NewSubscription registers a new resource with the given unique name, arguments, and options.
func NewSubscription(ctx *pulumi.Context,
name string, args *SubscriptionArgs, opts ...pulumi.ResourceOption) (*Subscription, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DisplayName == nil {
return nil, errors.New("invalid value for required argument 'DisplayName'")
}
if args.ProductId == nil {
return nil, errors.New("invalid value for required argument 'ProductId'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.ServiceName == nil {
return nil, errors.New("invalid value for required argument 'ServiceName'")
}
if args.Sid == nil {
return nil, errors.New("invalid value for required argument 'Sid'")
}
if args.UserId == nil {
return nil, errors.New("invalid value for required argument 'UserId'")
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("azure-nextgen:apimanagement/latest:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20160707:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20161010:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20180101:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20180601preview:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20190101:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20191201:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20191201preview:Subscription"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20200601preview:Subscription"),
},
})
opts = append(opts, aliases)
var resource Subscription
err := ctx.RegisterResource("azure-nextgen:apimanagement/v20170301:Subscription", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSubscription gets an existing Subscription 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 GetSubscription(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SubscriptionState, opts ...pulumi.ResourceOption) (*Subscription, error) {
var resource Subscription
err := ctx.ReadResource("azure-nextgen:apimanagement/v20170301:Subscription", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Subscription resources.
type subscriptionState struct {
// Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
CreatedDate *string `pulumi:"createdDate"`
// The name of the subscription, or null if the subscription has no name.
DisplayName *string `pulumi:"displayName"`
// Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
EndDate *string `pulumi:"endDate"`
// Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
ExpirationDate *string `pulumi:"expirationDate"`
// Resource name.
Name *string `pulumi:"name"`
// Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
NotificationDate *string `pulumi:"notificationDate"`
// Subscription primary key.
PrimaryKey *string `pulumi:"primaryKey"`
// The product resource identifier of the subscribed product. The value is a valid relative URL in the format of /products/{productId} where {productId} is a product identifier.
ProductId *string `pulumi:"productId"`
// Subscription secondary key.
SecondaryKey *string `pulumi:"secondaryKey"`
// Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
StartDate *string `pulumi:"startDate"`
// Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
State *string `pulumi:"state"`
// Optional subscription comment added by an administrator.
StateComment *string `pulumi:"stateComment"`
// Resource type for API Management resource.
Type *string `pulumi:"type"`
// The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{uid} where {uid} is a user identifier.
UserId *string `pulumi:"userId"`
}
type SubscriptionState struct {
// Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
CreatedDate pulumi.StringPtrInput
// The name of the subscription, or null if the subscription has no name.
DisplayName pulumi.StringPtrInput
// Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
EndDate pulumi.StringPtrInput
// Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
ExpirationDate pulumi.StringPtrInput
// Resource name.
Name pulumi.StringPtrInput
// Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
NotificationDate pulumi.StringPtrInput
// Subscription primary key.
PrimaryKey pulumi.StringPtrInput
// The product resource identifier of the subscribed product. The value is a valid relative URL in the format of /products/{productId} where {productId} is a product identifier.
ProductId pulumi.StringPtrInput
// Subscription secondary key.
SecondaryKey pulumi.StringPtrInput
// Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
StartDate pulumi.StringPtrInput
// Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
State pulumi.StringPtrInput
// Optional subscription comment added by an administrator.
StateComment pulumi.StringPtrInput
// Resource type for API Management resource.
Type pulumi.StringPtrInput
// The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{uid} where {uid} is a user identifier.
UserId pulumi.StringPtrInput
}
func (SubscriptionState) ElementType() reflect.Type {
return reflect.TypeOf((*subscriptionState)(nil)).Elem()
}
type subscriptionArgs struct {
// Subscription name.
DisplayName string `pulumi:"displayName"`
// Primary subscription key. If not specified during request key will be generated automatically.
PrimaryKey *string `pulumi:"primaryKey"`
// Product (product id path) for which subscription is being created in form /products/{productId}
ProductId string `pulumi:"productId"`
// The name of the resource group.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Secondary subscription key. If not specified during request key will be generated automatically.
SecondaryKey *string `pulumi:"secondaryKey"`
// The name of the API Management service.
ServiceName string `pulumi:"serviceName"`
// Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
Sid string `pulumi:"sid"`
// Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
State *string `pulumi:"state"`
// User (user id path) for whom subscription is being created in form /users/{uid}
UserId string `pulumi:"userId"`
}
// The set of arguments for constructing a Subscription resource.
type SubscriptionArgs struct {
// Subscription name.
DisplayName pulumi.StringInput
// Primary subscription key. If not specified during request key will be generated automatically.
PrimaryKey pulumi.StringPtrInput
// Product (product id path) for which subscription is being created in form /products/{productId}
ProductId pulumi.StringInput
// The name of the resource group.
ResourceGroupName pulumi.StringInput
// Secondary subscription key. If not specified during request key will be generated automatically.
SecondaryKey pulumi.StringPtrInput
// The name of the API Management service.
ServiceName pulumi.StringInput
// Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
Sid pulumi.StringInput
// Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
State *SubscriptionStateEnum
// User (user id path) for whom subscription is being created in form /users/{uid}
UserId pulumi.StringInput
}
func (SubscriptionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*subscriptionArgs)(nil)).Elem()
}
type SubscriptionInput interface {
pulumi.Input
ToSubscriptionOutput() SubscriptionOutput
ToSubscriptionOutputWithContext(ctx context.Context) SubscriptionOutput
}
func (*Subscription) ElementType() reflect.Type {
return reflect.TypeOf((*Subscription)(nil))
}
func (i *Subscription) ToSubscriptionOutput() SubscriptionOutput {
return i.ToSubscriptionOutputWithContext(context.Background())
}
func (i *Subscription) ToSubscriptionOutputWithContext(ctx context.Context) SubscriptionOutput {
return pulumi.ToOutputWithContext(ctx, i).(SubscriptionOutput)
}
type SubscriptionOutput struct {
*pulumi.OutputState
}
func (SubscriptionOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Subscription)(nil))
}
func (o SubscriptionOutput) ToSubscriptionOutput() SubscriptionOutput {
return o
}
func (o SubscriptionOutput) ToSubscriptionOutputWithContext(ctx context.Context) SubscriptionOutput {
return o
}
func init() {
pulumi.RegisterOutputType(SubscriptionOutput{})
}