Skip to content

Commit 889e001

Browse files
tt810Slavek Kabrda
authored andcommitted
Support logs index API (#271)
* Support logs index API * Support zerovalue for int64 in script
1 parent d2641d2 commit 889e001

File tree

10 files changed

+605
-1
lines changed

10 files changed

+605
-1
lines changed

cmd/tools/gen-accessors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func newAccessor(receiverType, fieldName, fieldType, zeroValue string) *accessor
175175
func (t *templateData) addIdent(x *ast.Ident, receiverType, fieldName string) {
176176
var zeroValue string
177177
switch x.String() {
178-
case "int":
178+
case "int", "int64":
179179
zeroValue = "0"
180180
case "string":
181181
zeroValue = `""`

datadog-accessors.go

Lines changed: 310 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6338,6 +6338,161 @@ func (e *EventTimelineDefinition) SetType(v string) {
63386338
e.Type = &v
63396339
}
63406340

6341+
// GetFilter returns the Filter field if non-nil, zero value otherwise.
6342+
func (e *ExclusionFilter) GetFilter() Filter {
6343+
if e == nil || e.Filter == nil {
6344+
return Filter{}
6345+
}
6346+
return *e.Filter
6347+
}
6348+
6349+
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
6350+
// and a boolean to check if the value has been set.
6351+
func (e *ExclusionFilter) GetFilterOk() (Filter, bool) {
6352+
if e == nil || e.Filter == nil {
6353+
return Filter{}, false
6354+
}
6355+
return *e.Filter, true
6356+
}
6357+
6358+
// HasFilter returns a boolean if a field has been set.
6359+
func (e *ExclusionFilter) HasFilter() bool {
6360+
if e != nil && e.Filter != nil {
6361+
return true
6362+
}
6363+
6364+
return false
6365+
}
6366+
6367+
// SetFilter allocates a new e.Filter and returns the pointer to it.
6368+
func (e *ExclusionFilter) SetFilter(v Filter) {
6369+
e.Filter = &v
6370+
}
6371+
6372+
// GetIsEnabled returns the IsEnabled field if non-nil, zero value otherwise.
6373+
func (e *ExclusionFilter) GetIsEnabled() bool {
6374+
if e == nil || e.IsEnabled == nil {
6375+
return false
6376+
}
6377+
return *e.IsEnabled
6378+
}
6379+
6380+
// GetIsEnabledOk returns a tuple with the IsEnabled field if it's non-nil, zero value otherwise
6381+
// and a boolean to check if the value has been set.
6382+
func (e *ExclusionFilter) GetIsEnabledOk() (bool, bool) {
6383+
if e == nil || e.IsEnabled == nil {
6384+
return false, false
6385+
}
6386+
return *e.IsEnabled, true
6387+
}
6388+
6389+
// HasIsEnabled returns a boolean if a field has been set.
6390+
func (e *ExclusionFilter) HasIsEnabled() bool {
6391+
if e != nil && e.IsEnabled != nil {
6392+
return true
6393+
}
6394+
6395+
return false
6396+
}
6397+
6398+
// SetIsEnabled allocates a new e.IsEnabled and returns the pointer to it.
6399+
func (e *ExclusionFilter) SetIsEnabled(v bool) {
6400+
e.IsEnabled = &v
6401+
}
6402+
6403+
// GetName returns the Name field if non-nil, zero value otherwise.
6404+
func (e *ExclusionFilter) GetName() string {
6405+
if e == nil || e.Name == nil {
6406+
return ""
6407+
}
6408+
return *e.Name
6409+
}
6410+
6411+
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
6412+
// and a boolean to check if the value has been set.
6413+
func (e *ExclusionFilter) GetNameOk() (string, bool) {
6414+
if e == nil || e.Name == nil {
6415+
return "", false
6416+
}
6417+
return *e.Name, true
6418+
}
6419+
6420+
// HasName returns a boolean if a field has been set.
6421+
func (e *ExclusionFilter) HasName() bool {
6422+
if e != nil && e.Name != nil {
6423+
return true
6424+
}
6425+
6426+
return false
6427+
}
6428+
6429+
// SetName allocates a new e.Name and returns the pointer to it.
6430+
func (e *ExclusionFilter) SetName(v string) {
6431+
e.Name = &v
6432+
}
6433+
6434+
// GetQuery returns the Query field if non-nil, zero value otherwise.
6435+
func (f *Filter) GetQuery() string {
6436+
if f == nil || f.Query == nil {
6437+
return ""
6438+
}
6439+
return *f.Query
6440+
}
6441+
6442+
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
6443+
// and a boolean to check if the value has been set.
6444+
func (f *Filter) GetQueryOk() (string, bool) {
6445+
if f == nil || f.Query == nil {
6446+
return "", false
6447+
}
6448+
return *f.Query, true
6449+
}
6450+
6451+
// HasQuery returns a boolean if a field has been set.
6452+
func (f *Filter) HasQuery() bool {
6453+
if f != nil && f.Query != nil {
6454+
return true
6455+
}
6456+
6457+
return false
6458+
}
6459+
6460+
// SetQuery allocates a new f.Query and returns the pointer to it.
6461+
func (f *Filter) SetQuery(v string) {
6462+
f.Query = &v
6463+
}
6464+
6465+
// GetSampleRate returns the SampleRate field if non-nil, zero value otherwise.
6466+
func (f *Filter) GetSampleRate() float64 {
6467+
if f == nil || f.SampleRate == nil {
6468+
return 0
6469+
}
6470+
return *f.SampleRate
6471+
}
6472+
6473+
// GetSampleRateOk returns a tuple with the SampleRate field if it's non-nil, zero value otherwise
6474+
// and a boolean to check if the value has been set.
6475+
func (f *Filter) GetSampleRateOk() (float64, bool) {
6476+
if f == nil || f.SampleRate == nil {
6477+
return 0, false
6478+
}
6479+
return *f.SampleRate, true
6480+
}
6481+
6482+
// HasSampleRate returns a boolean if a field has been set.
6483+
func (f *Filter) HasSampleRate() bool {
6484+
if f != nil && f.SampleRate != nil {
6485+
return true
6486+
}
6487+
6488+
return false
6489+
}
6490+
6491+
// SetSampleRate allocates a new f.SampleRate and returns the pointer to it.
6492+
func (f *Filter) SetSampleRate(v float64) {
6493+
f.SampleRate = &v
6494+
}
6495+
63416496
// GetQuery returns the Query field if non-nil, zero value otherwise.
63426497
func (f *FilterConfiguration) GetQuery() string {
63436498
if f == nil || f.Query == nil {
@@ -10771,6 +10926,161 @@ func (l *LogSet) SetName(v string) {
1077110926
l.Name = &v
1077210927
}
1077310928

10929+
// GetDailyLimit returns the DailyLimit field if non-nil, zero value otherwise.
10930+
func (l *LogsIndex) GetDailyLimit() int64 {
10931+
if l == nil || l.DailyLimit == nil {
10932+
return 0
10933+
}
10934+
return *l.DailyLimit
10935+
}
10936+
10937+
// GetDailyLimitOk returns a tuple with the DailyLimit field if it's non-nil, zero value otherwise
10938+
// and a boolean to check if the value has been set.
10939+
func (l *LogsIndex) GetDailyLimitOk() (int64, bool) {
10940+
if l == nil || l.DailyLimit == nil {
10941+
return 0, false
10942+
}
10943+
return *l.DailyLimit, true
10944+
}
10945+
10946+
// HasDailyLimit returns a boolean if a field has been set.
10947+
func (l *LogsIndex) HasDailyLimit() bool {
10948+
if l != nil && l.DailyLimit != nil {
10949+
return true
10950+
}
10951+
10952+
return false
10953+
}
10954+
10955+
// SetDailyLimit allocates a new l.DailyLimit and returns the pointer to it.
10956+
func (l *LogsIndex) SetDailyLimit(v int64) {
10957+
l.DailyLimit = &v
10958+
}
10959+
10960+
// GetFilter returns the Filter field if non-nil, zero value otherwise.
10961+
func (l *LogsIndex) GetFilter() FilterConfiguration {
10962+
if l == nil || l.Filter == nil {
10963+
return FilterConfiguration{}
10964+
}
10965+
return *l.Filter
10966+
}
10967+
10968+
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
10969+
// and a boolean to check if the value has been set.
10970+
func (l *LogsIndex) GetFilterOk() (FilterConfiguration, bool) {
10971+
if l == nil || l.Filter == nil {
10972+
return FilterConfiguration{}, false
10973+
}
10974+
return *l.Filter, true
10975+
}
10976+
10977+
// HasFilter returns a boolean if a field has been set.
10978+
func (l *LogsIndex) HasFilter() bool {
10979+
if l != nil && l.Filter != nil {
10980+
return true
10981+
}
10982+
10983+
return false
10984+
}
10985+
10986+
// SetFilter allocates a new l.Filter and returns the pointer to it.
10987+
func (l *LogsIndex) SetFilter(v FilterConfiguration) {
10988+
l.Filter = &v
10989+
}
10990+
10991+
// GetIsRateLimited returns the IsRateLimited field if non-nil, zero value otherwise.
10992+
func (l *LogsIndex) GetIsRateLimited() bool {
10993+
if l == nil || l.IsRateLimited == nil {
10994+
return false
10995+
}
10996+
return *l.IsRateLimited
10997+
}
10998+
10999+
// GetIsRateLimitedOk returns a tuple with the IsRateLimited field if it's non-nil, zero value otherwise
11000+
// and a boolean to check if the value has been set.
11001+
func (l *LogsIndex) GetIsRateLimitedOk() (bool, bool) {
11002+
if l == nil || l.IsRateLimited == nil {
11003+
return false, false
11004+
}
11005+
return *l.IsRateLimited, true
11006+
}
11007+
11008+
// HasIsRateLimited returns a boolean if a field has been set.
11009+
func (l *LogsIndex) HasIsRateLimited() bool {
11010+
if l != nil && l.IsRateLimited != nil {
11011+
return true
11012+
}
11013+
11014+
return false
11015+
}
11016+
11017+
// SetIsRateLimited allocates a new l.IsRateLimited and returns the pointer to it.
11018+
func (l *LogsIndex) SetIsRateLimited(v bool) {
11019+
l.IsRateLimited = &v
11020+
}
11021+
11022+
// GetName returns the Name field if non-nil, zero value otherwise.
11023+
func (l *LogsIndex) GetName() string {
11024+
if l == nil || l.Name == nil {
11025+
return ""
11026+
}
11027+
return *l.Name
11028+
}
11029+
11030+
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
11031+
// and a boolean to check if the value has been set.
11032+
func (l *LogsIndex) GetNameOk() (string, bool) {
11033+
if l == nil || l.Name == nil {
11034+
return "", false
11035+
}
11036+
return *l.Name, true
11037+
}
11038+
11039+
// HasName returns a boolean if a field has been set.
11040+
func (l *LogsIndex) HasName() bool {
11041+
if l != nil && l.Name != nil {
11042+
return true
11043+
}
11044+
11045+
return false
11046+
}
11047+
11048+
// SetName allocates a new l.Name and returns the pointer to it.
11049+
func (l *LogsIndex) SetName(v string) {
11050+
l.Name = &v
11051+
}
11052+
11053+
// GetNumRetentionDays returns the NumRetentionDays field if non-nil, zero value otherwise.
11054+
func (l *LogsIndex) GetNumRetentionDays() int64 {
11055+
if l == nil || l.NumRetentionDays == nil {
11056+
return 0
11057+
}
11058+
return *l.NumRetentionDays
11059+
}
11060+
11061+
// GetNumRetentionDaysOk returns a tuple with the NumRetentionDays field if it's non-nil, zero value otherwise
11062+
// and a boolean to check if the value has been set.
11063+
func (l *LogsIndex) GetNumRetentionDaysOk() (int64, bool) {
11064+
if l == nil || l.NumRetentionDays == nil {
11065+
return 0, false
11066+
}
11067+
return *l.NumRetentionDays, true
11068+
}
11069+
11070+
// HasNumRetentionDays returns a boolean if a field has been set.
11071+
func (l *LogsIndex) HasNumRetentionDays() bool {
11072+
if l != nil && l.NumRetentionDays != nil {
11073+
return true
11074+
}
11075+
11076+
return false
11077+
}
11078+
11079+
// SetNumRetentionDays allocates a new l.NumRetentionDays and returns the pointer to it.
11080+
func (l *LogsIndex) SetNumRetentionDays(v int64) {
11081+
l.NumRetentionDays = &v
11082+
}
11083+
1077411084
// GetFilter returns the Filter field if non-nil, zero value otherwise.
1077511085
func (l *LogsPipeline) GetFilter() FilterConfiguration {
1077611086
if l == nil || l.Filter == nil {

helpers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func GetBool(v *bool) (bool, bool) {
3333
// to store v and returns a pointer to it.
3434
func Int(v int) *int { return &v }
3535

36+
// Int64 is a helper routine that allocates a new int64 value to
37+
// store v and return a pointer to it.
38+
func Int64(v int64) *int64 { return &v }
39+
3640
// GetIntOk is a helper routine that returns a boolean representing
3741
// if a value was set, and if so, dereferences the pointer to it.
3842
func GetIntOk(v *int) (int, bool) {

0 commit comments

Comments
 (0)