|
| 1 | +// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** |
| 2 | +// *** Do not edit by hand unless you're certain you know what you are doing! *** |
| 3 | + |
| 4 | +using System; |
| 5 | +using System.Collections.Generic; |
| 6 | +using System.Collections.Immutable; |
| 7 | +using System.Threading.Tasks; |
| 8 | +using Pulumi.Serialization; |
| 9 | + |
| 10 | +namespace Pulumi.PostgreSql |
| 11 | +{ |
| 12 | + /// <summary> |
| 13 | + /// The ``postgresql.Function`` resource creates and manages a function on a PostgreSQL |
| 14 | + /// server. |
| 15 | + /// |
| 16 | + /// ## Usage |
| 17 | + /// |
| 18 | + /// ```csharp |
| 19 | + /// using Pulumi; |
| 20 | + /// using PostgreSql = Pulumi.PostgreSql; |
| 21 | + /// |
| 22 | + /// class MyStack : Stack |
| 23 | + /// { |
| 24 | + /// public MyStack() |
| 25 | + /// { |
| 26 | + /// var increment = new PostgreSql.Function("increment", new PostgreSql.FunctionArgs |
| 27 | + /// { |
| 28 | + /// Args = |
| 29 | + /// { |
| 30 | + /// new PostgreSql.Inputs.FunctionArgArgs |
| 31 | + /// { |
| 32 | + /// Name = "i", |
| 33 | + /// Type = "integer", |
| 34 | + /// }, |
| 35 | + /// }, |
| 36 | + /// Body = @" AS $ |
| 37 | + /// BEGIN |
| 38 | + /// RETURN i + 1; |
| 39 | + /// END; |
| 40 | + /// $ LANGUAGE plpgsql; |
| 41 | + /// |
| 42 | + /// ", |
| 43 | + /// Returns = "integer", |
| 44 | + /// }); |
| 45 | + /// } |
| 46 | + /// |
| 47 | + /// } |
| 48 | + /// ``` |
| 49 | + /// </summary> |
| 50 | + [PostgreSqlResourceType("postgresql:index/function:Function")] |
| 51 | + public partial class Function : Pulumi.CustomResource |
| 52 | + { |
| 53 | + /// <summary> |
| 54 | + /// List of arguments for the function. |
| 55 | + /// </summary> |
| 56 | + [Output("args")] |
| 57 | + public Output<ImmutableArray<Outputs.FunctionArg>> Args { get; private set; } = null!; |
| 58 | + |
| 59 | + /// <summary> |
| 60 | + /// Function body. |
| 61 | + /// This should be everything after the return type in the function definition. |
| 62 | + /// </summary> |
| 63 | + [Output("body")] |
| 64 | + public Output<string> Body { get; private set; } = null!; |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// True to automatically drop objects that depend on the function (such as |
| 68 | + /// operators or triggers), and in turn all objects that depend on those objects. Default is false. |
| 69 | + /// </summary> |
| 70 | + [Output("dropCascade")] |
| 71 | + public Output<bool?> DropCascade { get; private set; } = null!; |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// The name of the argument. |
| 75 | + /// </summary> |
| 76 | + [Output("name")] |
| 77 | + public Output<string> Name { get; private set; } = null!; |
| 78 | + |
| 79 | + /// <summary> |
| 80 | + /// Type that the function returns. |
| 81 | + /// </summary> |
| 82 | + [Output("returns")] |
| 83 | + public Output<string?> Returns { get; private set; } = null!; |
| 84 | + |
| 85 | + /// <summary> |
| 86 | + /// The schema where the function is located. |
| 87 | + /// If not specified, the function is created in the current schema. |
| 88 | + /// </summary> |
| 89 | + [Output("schema")] |
| 90 | + public Output<string> Schema { get; private set; } = null!; |
| 91 | + |
| 92 | + |
| 93 | + /// <summary> |
| 94 | + /// Create a Function resource with the given unique name, arguments, and options. |
| 95 | + /// </summary> |
| 96 | + /// |
| 97 | + /// <param name="name">The unique name of the resource</param> |
| 98 | + /// <param name="args">The arguments used to populate this resource's properties</param> |
| 99 | + /// <param name="options">A bag of options that control this resource's behavior</param> |
| 100 | + public Function(string name, FunctionArgs args, CustomResourceOptions? options = null) |
| 101 | + : base("postgresql:index/function:Function", name, args ?? new FunctionArgs(), MakeResourceOptions(options, "")) |
| 102 | + { |
| 103 | + } |
| 104 | + |
| 105 | + private Function(string name, Input<string> id, FunctionState? state = null, CustomResourceOptions? options = null) |
| 106 | + : base("postgresql:index/function:Function", name, state, MakeResourceOptions(options, id)) |
| 107 | + { |
| 108 | + } |
| 109 | + |
| 110 | + private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id) |
| 111 | + { |
| 112 | + var defaultOptions = new CustomResourceOptions |
| 113 | + { |
| 114 | + Version = Utilities.Version, |
| 115 | + }; |
| 116 | + var merged = CustomResourceOptions.Merge(defaultOptions, options); |
| 117 | + // Override the ID if one was specified for consistency with other language SDKs. |
| 118 | + merged.Id = id ?? merged.Id; |
| 119 | + return merged; |
| 120 | + } |
| 121 | + /// <summary> |
| 122 | + /// Get an existing Function resource's state with the given name, ID, and optional extra |
| 123 | + /// properties used to qualify the lookup. |
| 124 | + /// </summary> |
| 125 | + /// |
| 126 | + /// <param name="name">The unique name of the resulting resource.</param> |
| 127 | + /// <param name="id">The unique provider ID of the resource to lookup.</param> |
| 128 | + /// <param name="state">Any extra arguments used during the lookup.</param> |
| 129 | + /// <param name="options">A bag of options that control this resource's behavior</param> |
| 130 | + public static Function Get(string name, Input<string> id, FunctionState? state = null, CustomResourceOptions? options = null) |
| 131 | + { |
| 132 | + return new Function(name, id, state, options); |
| 133 | + } |
| 134 | + } |
| 135 | + |
| 136 | + public sealed class FunctionArgs : Pulumi.ResourceArgs |
| 137 | + { |
| 138 | + [Input("args")] |
| 139 | + private InputList<Inputs.FunctionArgArgs>? _args; |
| 140 | + |
| 141 | + /// <summary> |
| 142 | + /// List of arguments for the function. |
| 143 | + /// </summary> |
| 144 | + public InputList<Inputs.FunctionArgArgs> Args |
| 145 | + { |
| 146 | + get => _args ?? (_args = new InputList<Inputs.FunctionArgArgs>()); |
| 147 | + set => _args = value; |
| 148 | + } |
| 149 | + |
| 150 | + /// <summary> |
| 151 | + /// Function body. |
| 152 | + /// This should be everything after the return type in the function definition. |
| 153 | + /// </summary> |
| 154 | + [Input("body", required: true)] |
| 155 | + public Input<string> Body { get; set; } = null!; |
| 156 | + |
| 157 | + /// <summary> |
| 158 | + /// True to automatically drop objects that depend on the function (such as |
| 159 | + /// operators or triggers), and in turn all objects that depend on those objects. Default is false. |
| 160 | + /// </summary> |
| 161 | + [Input("dropCascade")] |
| 162 | + public Input<bool>? DropCascade { get; set; } |
| 163 | + |
| 164 | + /// <summary> |
| 165 | + /// The name of the argument. |
| 166 | + /// </summary> |
| 167 | + [Input("name")] |
| 168 | + public Input<string>? Name { get; set; } |
| 169 | + |
| 170 | + /// <summary> |
| 171 | + /// Type that the function returns. |
| 172 | + /// </summary> |
| 173 | + [Input("returns")] |
| 174 | + public Input<string>? Returns { get; set; } |
| 175 | + |
| 176 | + /// <summary> |
| 177 | + /// The schema where the function is located. |
| 178 | + /// If not specified, the function is created in the current schema. |
| 179 | + /// </summary> |
| 180 | + [Input("schema")] |
| 181 | + public Input<string>? Schema { get; set; } |
| 182 | + |
| 183 | + public FunctionArgs() |
| 184 | + { |
| 185 | + } |
| 186 | + } |
| 187 | + |
| 188 | + public sealed class FunctionState : Pulumi.ResourceArgs |
| 189 | + { |
| 190 | + [Input("args")] |
| 191 | + private InputList<Inputs.FunctionArgGetArgs>? _args; |
| 192 | + |
| 193 | + /// <summary> |
| 194 | + /// List of arguments for the function. |
| 195 | + /// </summary> |
| 196 | + public InputList<Inputs.FunctionArgGetArgs> Args |
| 197 | + { |
| 198 | + get => _args ?? (_args = new InputList<Inputs.FunctionArgGetArgs>()); |
| 199 | + set => _args = value; |
| 200 | + } |
| 201 | + |
| 202 | + /// <summary> |
| 203 | + /// Function body. |
| 204 | + /// This should be everything after the return type in the function definition. |
| 205 | + /// </summary> |
| 206 | + [Input("body")] |
| 207 | + public Input<string>? Body { get; set; } |
| 208 | + |
| 209 | + /// <summary> |
| 210 | + /// True to automatically drop objects that depend on the function (such as |
| 211 | + /// operators or triggers), and in turn all objects that depend on those objects. Default is false. |
| 212 | + /// </summary> |
| 213 | + [Input("dropCascade")] |
| 214 | + public Input<bool>? DropCascade { get; set; } |
| 215 | + |
| 216 | + /// <summary> |
| 217 | + /// The name of the argument. |
| 218 | + /// </summary> |
| 219 | + [Input("name")] |
| 220 | + public Input<string>? Name { get; set; } |
| 221 | + |
| 222 | + /// <summary> |
| 223 | + /// Type that the function returns. |
| 224 | + /// </summary> |
| 225 | + [Input("returns")] |
| 226 | + public Input<string>? Returns { get; set; } |
| 227 | + |
| 228 | + /// <summary> |
| 229 | + /// The schema where the function is located. |
| 230 | + /// If not specified, the function is created in the current schema. |
| 231 | + /// </summary> |
| 232 | + [Input("schema")] |
| 233 | + public Input<string>? Schema { get; set; } |
| 234 | + |
| 235 | + public FunctionState() |
| 236 | + { |
| 237 | + } |
| 238 | + } |
| 239 | +} |
0 commit comments