Replace ValuePointer function with custom conversion (#121)

This commit is contained in:
Vicente Pinto 2023-11-02 15:28:06 +00:00 committed by GitHub
parent b10302c6de
commit b6100ec8d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 221 additions and 191 deletions

View file

@ -451,16 +451,16 @@ func toCreatePayload(model *Model) (*dns.CreateRecordSetPayload, error) {
return nil, fmt.Errorf("expected record at index %d to be of type %T, got %T", i, types.String{}, record)
}
records = append(records, dns.RecordPayload{
Content: recordString.ValueStringPointer(),
Content: core.StringValueToPointer(recordString),
})
}
return &dns.CreateRecordSetPayload{
Comment: model.Comment.ValueStringPointer(),
Name: model.Name.ValueStringPointer(),
Comment: core.StringValueToPointer(model.Comment),
Name: core.StringValueToPointer(model.Name),
Records: &records,
Ttl: model.TTL.ValueInt64Pointer(),
Type: model.Type.ValueStringPointer(),
Ttl: core.Int64ValueToPointer(model.TTL),
Type: core.StringValueToPointer(model.Type),
}, nil
}
@ -476,14 +476,14 @@ func toUpdatePayload(model *Model) (*dns.UpdateRecordSetPayload, error) {
return nil, fmt.Errorf("expected record at index %d to be of type %T, got %T", i, types.String{}, record)
}
records = append(records, dns.RecordPayload{
Content: recordString.ValueStringPointer(),
Content: core.StringValueToPointer(recordString),
})
}
return &dns.UpdateRecordSetPayload{
Comment: model.Comment.ValueStringPointer(),
Name: model.Name.ValueStringPointer(),
Comment: core.StringValueToPointer(model.Comment),
Name: core.StringValueToPointer(model.Name),
Records: &records,
Ttl: model.TTL.ValueInt64Pointer(),
Ttl: core.Int64ValueToPointer(model.TTL),
}, nil
}