generated from pulumi/pulumi-tf-provider-boilerplate
/
getRecommendations.go
245 lines (219 loc) · 12.8 KB
/
getRecommendations.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
// 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 optimizer
import (
"context"
"reflect"
"github.com/pulumi/pulumi-oci/sdk/go/oci/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This data source provides the list of Recommendations in Oracle Cloud Infrastructure Optimizer service.
//
// Lists the Cloud Advisor recommendations that are currently supported.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-oci/sdk/go/oci/Optimizer"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := Optimizer.GetRecommendations(ctx, &optimizer.GetRecommendationsArgs{
// CompartmentId: compartmentId,
// CompartmentIdInSubtree: recommendationCompartmentIdInSubtree,
// CategoryId: pulumi.StringRef(testCategory.Id),
// CategoryName: pulumi.StringRef(testCategory.Name),
// ChildTenancyIds: recommendationChildTenancyIds,
// IncludeOrganization: pulumi.BoolRef(recommendationIncludeOrganization),
// Name: pulumi.StringRef(recommendationName),
// State: pulumi.StringRef(recommendationState),
// Status: pulumi.StringRef(recommendationStatus),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func GetRecommendations(ctx *pulumi.Context, args *GetRecommendationsArgs, opts ...pulumi.InvokeOption) (*GetRecommendationsResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetRecommendationsResult
err := ctx.Invoke("oci:Optimizer/getRecommendations:getRecommendations", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getRecommendations.
type GetRecommendationsArgs struct {
// The unique OCID associated with the category.
CategoryId *string `pulumi:"categoryId"`
// Optional. A filter that returns results that match the category name specified.
CategoryName *string `pulumi:"categoryName"`
// A list of child tenancies for which the respective data will be returned. Please note that the parent tenancy id can also be included in this list. For example, if there is a parent P with two children A and B, to return results of only parent P and child A, this list should be populated with tenancy id of parent P and child A.
//
// If this list contains a tenancy id that isn't part of the organization of parent P, the request will fail. That is, let's say there is an organization with parent P with children A and B, and also one other tenant T that isn't part of the organization. If T is included in the list of childTenancyIds, the request will fail.
//
// It is important to note that if you are setting the includeOrganization parameter value as true and also populating the childTenancyIds parameter with a list of child tenancies, the request will fail. The childTenancyIds and includeOrganization should be used exclusively.
//
// When using this parameter, please make sure to set the compartmentId with the parent tenancy ID.
ChildTenancyIds []string `pulumi:"childTenancyIds"`
// The OCID of the compartment.
CompartmentId string `pulumi:"compartmentId"`
// When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of `accessLevel`.
//
// Can only be set to true when performing ListCompartments on the tenancy (root compartment).
CompartmentIdInSubtree bool `pulumi:"compartmentIdInSubtree"`
Filters []GetRecommendationsFilter `pulumi:"filters"`
// When set to true, the data for all child tenancies including the parent is returned. That is, if there is an organization with parent P and children A and B, to return the data for the parent P, child A and child B, this parameter value should be set to true.
//
// Please note that this parameter shouldn't be used along with childTenancyIds parameter. If you would like to get results specifically for parent P and only child A, use the childTenancyIds parameter and populate the list with tenancy id of P and A.
//
// When using this parameter, please make sure to set the compartmentId with the parent tenancy ID.
IncludeOrganization *bool `pulumi:"includeOrganization"`
// Optional. A filter that returns results that match the name specified.
Name *string `pulumi:"name"`
// A filter that returns results that match the lifecycle state specified.
State *string `pulumi:"state"`
// A filter that returns recommendations that match the status specified.
Status *string `pulumi:"status"`
}
// A collection of values returned by getRecommendations.
type GetRecommendationsResult struct {
// The unique OCID associated with the category.
CategoryId *string `pulumi:"categoryId"`
CategoryName *string `pulumi:"categoryName"`
ChildTenancyIds []string `pulumi:"childTenancyIds"`
// The OCID of the tenancy. The tenancy is the root compartment.
CompartmentId string `pulumi:"compartmentId"`
CompartmentIdInSubtree bool `pulumi:"compartmentIdInSubtree"`
Filters []GetRecommendationsFilter `pulumi:"filters"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
IncludeOrganization *bool `pulumi:"includeOrganization"`
// The name of the profile level.
Name *string `pulumi:"name"`
// The list of recommendation_collection.
RecommendationCollections []GetRecommendationsRecommendationCollection `pulumi:"recommendationCollections"`
// The recommendation's current state.
State *string `pulumi:"state"`
// The current status of the recommendation.
Status *string `pulumi:"status"`
}
func GetRecommendationsOutput(ctx *pulumi.Context, args GetRecommendationsOutputArgs, opts ...pulumi.InvokeOption) GetRecommendationsResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetRecommendationsResult, error) {
args := v.(GetRecommendationsArgs)
r, err := GetRecommendations(ctx, &args, opts...)
var s GetRecommendationsResult
if r != nil {
s = *r
}
return s, err
}).(GetRecommendationsResultOutput)
}
// A collection of arguments for invoking getRecommendations.
type GetRecommendationsOutputArgs struct {
// The unique OCID associated with the category.
CategoryId pulumi.StringPtrInput `pulumi:"categoryId"`
// Optional. A filter that returns results that match the category name specified.
CategoryName pulumi.StringPtrInput `pulumi:"categoryName"`
// A list of child tenancies for which the respective data will be returned. Please note that the parent tenancy id can also be included in this list. For example, if there is a parent P with two children A and B, to return results of only parent P and child A, this list should be populated with tenancy id of parent P and child A.
//
// If this list contains a tenancy id that isn't part of the organization of parent P, the request will fail. That is, let's say there is an organization with parent P with children A and B, and also one other tenant T that isn't part of the organization. If T is included in the list of childTenancyIds, the request will fail.
//
// It is important to note that if you are setting the includeOrganization parameter value as true and also populating the childTenancyIds parameter with a list of child tenancies, the request will fail. The childTenancyIds and includeOrganization should be used exclusively.
//
// When using this parameter, please make sure to set the compartmentId with the parent tenancy ID.
ChildTenancyIds pulumi.StringArrayInput `pulumi:"childTenancyIds"`
// The OCID of the compartment.
CompartmentId pulumi.StringInput `pulumi:"compartmentId"`
// When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of `accessLevel`.
//
// Can only be set to true when performing ListCompartments on the tenancy (root compartment).
CompartmentIdInSubtree pulumi.BoolInput `pulumi:"compartmentIdInSubtree"`
Filters GetRecommendationsFilterArrayInput `pulumi:"filters"`
// When set to true, the data for all child tenancies including the parent is returned. That is, if there is an organization with parent P and children A and B, to return the data for the parent P, child A and child B, this parameter value should be set to true.
//
// Please note that this parameter shouldn't be used along with childTenancyIds parameter. If you would like to get results specifically for parent P and only child A, use the childTenancyIds parameter and populate the list with tenancy id of P and A.
//
// When using this parameter, please make sure to set the compartmentId with the parent tenancy ID.
IncludeOrganization pulumi.BoolPtrInput `pulumi:"includeOrganization"`
// Optional. A filter that returns results that match the name specified.
Name pulumi.StringPtrInput `pulumi:"name"`
// A filter that returns results that match the lifecycle state specified.
State pulumi.StringPtrInput `pulumi:"state"`
// A filter that returns recommendations that match the status specified.
Status pulumi.StringPtrInput `pulumi:"status"`
}
func (GetRecommendationsOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetRecommendationsArgs)(nil)).Elem()
}
// A collection of values returned by getRecommendations.
type GetRecommendationsResultOutput struct{ *pulumi.OutputState }
func (GetRecommendationsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetRecommendationsResult)(nil)).Elem()
}
func (o GetRecommendationsResultOutput) ToGetRecommendationsResultOutput() GetRecommendationsResultOutput {
return o
}
func (o GetRecommendationsResultOutput) ToGetRecommendationsResultOutputWithContext(ctx context.Context) GetRecommendationsResultOutput {
return o
}
// The unique OCID associated with the category.
func (o GetRecommendationsResultOutput) CategoryId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetRecommendationsResult) *string { return v.CategoryId }).(pulumi.StringPtrOutput)
}
func (o GetRecommendationsResultOutput) CategoryName() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetRecommendationsResult) *string { return v.CategoryName }).(pulumi.StringPtrOutput)
}
func (o GetRecommendationsResultOutput) ChildTenancyIds() pulumi.StringArrayOutput {
return o.ApplyT(func(v GetRecommendationsResult) []string { return v.ChildTenancyIds }).(pulumi.StringArrayOutput)
}
// The OCID of the tenancy. The tenancy is the root compartment.
func (o GetRecommendationsResultOutput) CompartmentId() pulumi.StringOutput {
return o.ApplyT(func(v GetRecommendationsResult) string { return v.CompartmentId }).(pulumi.StringOutput)
}
func (o GetRecommendationsResultOutput) CompartmentIdInSubtree() pulumi.BoolOutput {
return o.ApplyT(func(v GetRecommendationsResult) bool { return v.CompartmentIdInSubtree }).(pulumi.BoolOutput)
}
func (o GetRecommendationsResultOutput) Filters() GetRecommendationsFilterArrayOutput {
return o.ApplyT(func(v GetRecommendationsResult) []GetRecommendationsFilter { return v.Filters }).(GetRecommendationsFilterArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetRecommendationsResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetRecommendationsResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o GetRecommendationsResultOutput) IncludeOrganization() pulumi.BoolPtrOutput {
return o.ApplyT(func(v GetRecommendationsResult) *bool { return v.IncludeOrganization }).(pulumi.BoolPtrOutput)
}
// The name of the profile level.
func (o GetRecommendationsResultOutput) Name() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetRecommendationsResult) *string { return v.Name }).(pulumi.StringPtrOutput)
}
// The list of recommendation_collection.
func (o GetRecommendationsResultOutput) RecommendationCollections() GetRecommendationsRecommendationCollectionArrayOutput {
return o.ApplyT(func(v GetRecommendationsResult) []GetRecommendationsRecommendationCollection {
return v.RecommendationCollections
}).(GetRecommendationsRecommendationCollectionArrayOutput)
}
// The recommendation's current state.
func (o GetRecommendationsResultOutput) State() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetRecommendationsResult) *string { return v.State }).(pulumi.StringPtrOutput)
}
// The current status of the recommendation.
func (o GetRecommendationsResultOutput) Status() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetRecommendationsResult) *string { return v.Status }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(GetRecommendationsResultOutput{})
}